Crete ZIP file in memory

Source: https://medium.com/@harrietty/zipping-and-unzipping-files-with-nodejs-375d2750c5e4

https://stackoverflow.com/questions/42992604/crete-zip-file-in-memory-using-any-node-module

If GZip will do, you can use the built-in zlib module and not even have to load an external module.
const zlib = require('zlib');
const gzip = zlib.createGzip();
// If you have an inputStream and an outputStream:

inputStream.pipe(gzip).pipe(outputStream);
For Zip and not GZip, you can check out archiver or zip-stream.

All the unzipping for all the files


const fs = require('fs');
const zlib = require('zlib');
const directoryFiles = fs.readdirSync('./data');
directoryFiles.forEach(filename => {
const fileContents = fs.createReadStream(`./data/${filename}`);
const writeStream = fs.createWriteStream(`./data/${filename.slice(0, -3)}`);
const unzip = zlib.createGunzip();
fileContents.pipe(unzip).pipe(writeStream);
});

Node Upload S3 folder

Source: https://www.zeolearn.com/magazine/uploading-files-to-aws-s3-using-nodejs

Bucket is name of your bucket and key is name of subfolder. So, if your bucket name is “test-bucket” and you want to save file in “test-bucket/folder/subfolder/file.csv”, then value of Key should be “folder/subfolder/file.csv”.

Can't bind to 'routerLink' since it isn't a known property

Source: https://stackoverflow.com/questions/42035387/cant-bind-to-routerlink-since-it-isnt-a-known-property

You need to add RouterModule to imports of every @NgModule() where components use any component or directive from (in this case routerLink and <router-outlet>.
declarations: [] is to make components, directives, pipes, known inside the current module.
exports: [] is to make components, directives, pipes, available to importing modules. What is added to declarations only is private to the module. exports makes them public.

Select element based on multiple classes

Source: https://stackoverflow.com/questions/2554839/select-element-based-on-multiple-classes

You mean two classes? "Chain" the selectors (no spaces between them):
.class1.class2 {
    /* style here */
}
This selects all elements with class1 that also have class2.
In your case:
li.left.ui-class-selector {

}
Official documentation : CSS2 class selectors.

bootstrap dropdown bubble align right (not push-right)

Source: https://stackoverflow.com/questions/18892351/bootstrap-dropdown-bubble-align-right-not-push-right

Bootstrap 3.1+
Adding the class .dropdown-menu-right to the same div containing the class dropdown-menu:
<div class="dropdown-menu dropdown-menu-right">
    STUFF
</div>
Bootstrap 2.3 & 3.0
Add the class .pull-right to the same div containing the class dropdown-menu
<div class="dropdown-menu pull-right">
    STUFF
</div>
This seems to work for me using bootstrap 3.0

Download a file from NodeJS Server using Express

Source:

Update

Express has a helper for this to make life easier.
app.get('/download', function(req, res){
  const file = `${__dirname}/upload-folder/dramaticpenguin.MOV`;
  res.download(file); // Set disposition and send it.
});

Old Answer

As far as your browser is concerned, the file's name is just 'download', so you need to give it more info by using another HTTP header.
res.setHeader('Content-disposition', 'attachment; filename=dramaticpenguin.MOV');
You may also want to send a mime-type such as this:
res.setHeader('Content-type', 'video/quicktime');
If you want something more in-depth, here ya go.
var path = require('path');
var mime = require('mime');
var fs = require('fs');

app.get('/download', function(req, res){

  var file = __dirname + '/upload-folder/dramaticpenguin.MOV';

  var filename = path.basename(file);
  var mimetype = mime.lookup(file);

  res.setHeader('Content-disposition', 'attachment; filename=' + filename);
  res.setHeader('Content-type', mimetype);

  var filestream = fs.createReadStream(file);
  filestream.pipe(res);
});
You can set the header value to whatever you like. In this case, I am using a mime-type library - node-mime, to check what the mime-type of the file is.
Another important thing to note here is that I have changed your code to use a readStream. This is a much better way to do things because using any method with 'Sync' in the name is frowned upon because node is meant to be asynchronous.

anti-pattern là gì

  Trong công nghệ và lập trình, Anti-pattern (mẫu phản diện) là những giải pháp bề ngoài có vẻ hiệu quả để giải quyết một vấn đề phổ biến, ...