Skip to content

Commit 96a195f

Browse files
Add FS options to the request params
1 parent 339db76 commit 96a195f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

script.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ app.get('/', (req, res) => res.send('Hello, I write data to file. Send them requ
2121

2222
app.post('/write', (req, res) => {
2323
let extension = req.body.fileExtension || defaultFileExtension,
24-
fsMode = req.body.mode || DEFAULT_MODE;
24+
fsMode = req.body.mode || DEFAULT_MODE,
2525
uniqueIdentifier = req.body.uniqueIdentifier ? typeof req.body.uniqueIdentifier === 'boolean' ? Date.now() : req.body.uniqueIdentifier : false,
2626
filename = `${req.body.requestName}${uniqueIdentifier || ''}`,
27-
filePath = `${path.join(folderPath, filename)}.${extension}`;
27+
filePath = `${path.join(folderPath, filename)}.${extension}`,
28+
options = req.body.options || undefined;
2829

29-
fs[fsMode](filePath, req.body.responseData, (err) => {
30+
fs[fsMode](filePath, req.body.responseData, options, (err) => {
3031
if (err) {
3132
console.log(err);
3233
res.send('Error');

0 commit comments

Comments
 (0)