diff --git a/.gitignore b/.gitignore
index 634d1b1..1eee89f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,4 @@ results
npm-debug.log
node_modules
coverage
+.nyc_output/
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..4edc04d
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,21 @@
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+node_modules
+coverage
+.jshintrc
+.travis.yml
+.nyc_output/
+test/
+CHANGES.md
diff --git a/.travis.yml b/.travis.yml
index ceafed9..bf696d8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,6 @@
language: node_js
node_js:
- - "6"
- - "8"
- - "10"
+ - "14"
+ - "16"
+ - "18"
+ - "19"
diff --git a/CHANGES.md b/CHANGES.md
index 1812a03..b10612a 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,20 @@
+TBD, Version 2.0.0
+=========================
+
+* Update truncate from 2.x to 3.x
+
+* Update dev dependencies to latest
+
+* Replace deprecated package istanbul with nyc
+
+* Require Node.js 14+ (Breaking change)
+
+* Travis: add Node.js 14,16,18,19 support, remove legacy versions
+
+* Remove instances of deprecated `new Buffer`
+
+* Ensure extraneous files are not bundled into package with .npmignore
+
2018-05-31, Version 1.0.6
=========================
diff --git a/README.md b/README.md
index e29c212..f1d0852 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ uri = dataUri.encode('foo');
console.log(uri);
// data:text/plain;charset=UTF-8;base64,Zm9v
-uri = dataUri.encode(new Buffer('', 'utf8'), 'text/xml');
+uri = dataUri.encode(Buffer.from('', 'utf8'), 'text/xml');
console.log(uri);
// data:text/xml;base64,PGZvby8+
```
diff --git a/index.js b/index.js
index 3dc7304..37c8e72 100644
--- a/index.js
+++ b/index.js
@@ -80,9 +80,9 @@ function decode(uri) {
}
if (b64) {
- result = new Buffer(body, 'base64');
+ result = Buffer.from(body, 'base64');
} else {
- result = new Buffer(decodeURIComponent(body), 'ascii');
+ result = Buffer.from(decodeURIComponent(body), 'ascii');
}
result.mimetype = mimetype;
@@ -100,7 +100,7 @@ function encode(input, mediatype) {
buf = input;
mediatype = mediatype || 'application/octet-stream';
} else if (typeof(input) == 'string') {
- buf = new Buffer(input, 'utf8');
+ buf = Buffer.from(input, 'utf8');
mediatype = mediatype || 'text/plain;charset=UTF-8';
} else {
// TODO: support streams?
diff --git a/package.json b/package.json
index d53837e..d647af7 100644
--- a/package.json
+++ b/package.json
@@ -6,8 +6,7 @@
"main": "index.js",
"scripts": {
"pretest": "jshint *.js test",
- "test": "istanbul test -- _mocha -R spec",
- "posttest": "test -z $npm_config_coverage || istanbul report"
+ "test": "nyc -r lcov _mocha -R spec"
},
"repository": {
"type": "git",
@@ -18,15 +17,15 @@
"email": "miroslav@strongloop.com"
},
"dependencies": {
- "truncate": "^2.0.1"
+ "truncate": "^3.0.0"
},
"devDependencies": {
- "mocha": "~1.17.1",
- "jshint": "~2.4.3",
- "istanbul": "~0.2.4",
- "chai": "~1.8.1"
+ "chai": "~4.3.7",
+ "jshint": "~2.13.6",
+ "mocha": "~10.2.0",
+ "nyc": "15.1.0"
},
"engines": {
- "node": ">=0.8.0"
+ "node": ">=14"
}
}
diff --git a/test/encode.js b/test/encode.js
index 8115b99..c3cb663 100644
--- a/test/encode.js
+++ b/test/encode.js
@@ -31,13 +31,13 @@ var dataUri = require('..');
describe('encode', function() {
it('creates from buffer', function() {
- var uri = dataUri.encode(new Buffer('foo', 'utf8'), 'text/plain');
+ var uri = dataUri.encode(Buffer.from('foo', 'utf8'), 'text/plain');
expect(uri).to.be.a('string');
expect(uri).to.equal('data:text/plain;base64,Zm9v');
});
it('creates from buffer with default mediatype', function() {
- var uri = dataUri.encode(new Buffer('foo', 'utf8'));
+ var uri = dataUri.encode(Buffer.from('foo', 'utf8'));
expect(uri).to.be.a('string');
expect(uri).to.equal('data:application/octet-stream;base64,Zm9v');
});