From 068ab7d7ec3588b819ffb1f293be5c956814c323 Mon Sep 17 00:00:00 2001 From: Cliff Crosland Date: Tue, 25 Nov 2014 17:31:19 -0800 Subject: [PATCH] Update README.md to explain custom file use case Adding documentation to indicate a use case for custom file values and options in multipart form data requests. The added sentence may have saved my team a few hours. Use case: - A user wants to upload a file to your service, and you in turn want to upload the file to an external service. - Constraint: you don't want the file to be written to disk in your service. - Because you're uploading a file from a stream, you need to add custom file-related information manually in your request to the external service. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c2c1c860e..c39685e25 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,7 @@ var formData = { fs.createReadStream(__dirname + '/attachment2.jpg') ], // Pass optional meta-data with an 'options' object with style: {value: DATA, options: OPTIONS} + // Use case: for some types of streams, you'll need to provide "file"-related information manually. // See the `form-data` README for more information about options: https://github.com/felixge/node-form-data custom_file: { value: fs.createReadStream('/dev/urandom'),