Skip to content

ES6 Promise version .vm #42

@Kailang

Description

@Kailang

Trying to add a ES6 Promise version of the .mv function.

Here's the draft:

        mvPromise: function(path) {
          return new Promise((resolve, reject) => {
            let fstream = fs.createWriteStream(path);

            streamifier.createReadStream(buf).pipe(fstream);

            fstream.on('error', function(error) {
              reject(error);
            });

            fstream.on('close', function() {
              resolve();
            });
          });
        }

This should be appended after the .vm definition in let newFile.

Any suggestions? If this looks good, I'll create a pull request with a test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions