From 1837dc245fabc8f866d099614a9aef5f799742f1 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig Date: Sat, 5 Jan 2019 12:45:10 +0100 Subject: [PATCH] Use Buffer.from --- .../core/integration-tests/test/integration/globals/index.js | 2 +- packages/core/integration-tests/test/javascript.js | 2 +- packages/core/parcel-bundler/src/assets/JSAsset.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/integration-tests/test/integration/globals/index.js b/packages/core/integration-tests/test/integration/globals/index.js index fa6f5ff1411..d036bcb5735 100644 --- a/packages/core/integration-tests/test/integration/globals/index.js +++ b/packages/core/integration-tests/test/integration/globals/index.js @@ -2,7 +2,7 @@ module.exports = function () { return { dir: __dirname, file: __filename, - buf: new Buffer(process.title).toString('base64'), + buf: Buffer.from(process.title).toString('base64'), global: !!global.document }; }; diff --git a/packages/core/integration-tests/test/javascript.js b/packages/core/integration-tests/test/javascript.js index a0474f8212e..ba255be5792 100644 --- a/packages/core/integration-tests/test/javascript.js +++ b/packages/core/integration-tests/test/javascript.js @@ -802,7 +802,7 @@ describe('javascript', function() { assert.deepEqual(output(), { dir: path.join(__dirname, '/integration/globals'), file: path.join(__dirname, '/integration/globals/index.js'), - buf: new Buffer('browser').toString('base64'), + buf: Buffer.from('browser').toString('base64'), global: true }); }); diff --git a/packages/core/parcel-bundler/src/assets/JSAsset.js b/packages/core/parcel-bundler/src/assets/JSAsset.js index 5e108895203..286f55a9cb2 100644 --- a/packages/core/parcel-bundler/src/assets/JSAsset.js +++ b/packages/core/parcel-bundler/src/assets/JSAsset.js @@ -95,7 +95,7 @@ class JSAsset extends Asset { let json, filename; if (dataURLMatch) { filename = this.name; - json = new Buffer(dataURLMatch[1], 'base64').toString(); + json = Buffer.from(dataURLMatch[1], 'base64').toString(); } else { filename = path.join(path.dirname(this.name), url); json = await fs.readFile(filename, 'utf8');