provide instruction for old node users

This commit is contained in:
AJ ONeal 2018-09-03 13:18:01 -06:00
parent b4466d937d
commit 54b2954229
2 changed files with 12 additions and 4 deletions

View File

@ -8,10 +8,18 @@ try {
} }
var util = require('util'); var util = require('util');
var promisify = util.promisify || PromiseA.promisify;
if (!PromiseA || !promisify) {
throw new Error("DON'T PANIC. Everything is A-OK."
+ " However, you're on a really old version of node. All you need to do is `npm install --save bluebird`"
+ " (in your project directory, which is probably '" + require('path').dirname(require.main.filename) + "')"
+ " and everything will work just fine.");
}
var fs = require('fs'); var fs = require('fs');
var writeFileAsync = util.promisify(fs.writeFile); var writeFileAsync = promisify(fs.writeFile);
var unlinkAsync = util.promisify(fs.unlink); var unlinkAsync = promisify(fs.unlink);
var renameAsync = util.promisify(fs.rename); var renameAsync = promisify(fs.rename);
var crypto = require('crypto'); var crypto = require('crypto');
function noop() { function noop() {

View File

@ -1,6 +1,6 @@
{ {
"name": "safe-replace", "name": "safe-replace",
"version": "1.0.3", "version": "1.1.0",
"description": "A micro-module for safely replacing a file.", "description": "A micro-module for safely replacing a file.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {