Skip to content

Problem with fs.writeFile #17

@sstur

Description

@sstur

This appears to be caused by the fact that fs module is mutated by promisify('fs'). Internally, fs.writeFile uses some other fs methods in a callback fashion, so it expects fs to be un-modified.

Repro:

const promisify = require('promisify-node');
const fs = promisify('fs');
fs.writeFile('./testfile.txt', 'Hello World')
  .then(() => {
    console.log('File saved!');
  })
  .catch((error) => {
    console.error('Error doing something:', error);
  });

Neither 'File saved!' or 'Error doing something' ever gets logged. The file gets created but no data is written to it. Tested on OS X 10.11 using Node v5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions