Skip to content

Commit

Permalink
Fix corrupted 'File.contents' [#191,#218]
Browse files Browse the repository at this point in the history
  • Loading branch information
bezoerb committed Dec 1, 2017
1 parent fd6e6fb commit e9761a7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/file-helper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
const os = require('os');
const fs = require('fs');
const url = require('url');
const path = require('path');
const fs = require('fs-extra');
const _ = require('lodash');
const Bluebird = require('bluebird');
const request = require('request');
Expand All @@ -17,7 +17,6 @@ const File = require('./vinyl-remote');
const gc = require('./gc');

Bluebird.promisifyAll(tmp);
Bluebird.promisifyAll(fs);
tmp.setGracefulCleanup();

/**
Expand Down Expand Up @@ -122,7 +121,7 @@ function temp(opts) {
.then(getFirst)
.then(path => {
gc.addFile(path);
return fs.writeFileAsync(path, resp.body).then(() => {
return fs.outputFile(path, resp.body).then(() => {
return path;
});
});
Expand Down Expand Up @@ -327,7 +326,7 @@ function getVinylPromise(opts) {
file.contents = Buffer.from(opts.html);
debug(file);
gc.addFile(filepath);
return fs.writeFileAsync(filepath, file.contents).then(() => {
return fs.outputFile(filepath, file.contents).then(() => {
return file;
});
});
Expand All @@ -343,7 +342,7 @@ function getVinylPromise(opts) {
file.path = path.relative(process.cwd(), data);
}

return fs.readFileAsync(file.path).then(contents => {
return fs.readFile(file.path).then(contents => {
file.contents = contents;
return file;
});
Expand Down

0 comments on commit e9761a7

Please sign in to comment.