Skip to content

Commit

Permalink
Fix #67 Usage of Buffer constructor is deprecated in Node 10 (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
regevbr authored Nov 18, 2019
1 parent 07b1128 commit e2942bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@
},
"homepage": "https://github.com/PruvoNet/squiss-ts#readme",
"dependencies": {
"aws-sdk": "^2.568.0",
"aws-sdk": "^2.572.0",
"iltorb": "2.4.3",
"linked-list": "^2.1.0",
"ts-type-guards": "^0.6.1",
"uuid": "^3.3.3"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^0.1.3",
"@types/chai": "^4.2.4",
"@types/chai": "^4.2.5",
"@types/chai-as-promised": "^7.1.2",
"@types/iltorb": "^2.3.0",
"@types/mocha": "^5.2.7",
"@types/node": "^12.12.7",
"@types/node": "^12.12.8",
"@types/proxyquire": "^1.3.28",
"@types/uuid": "^3.4.6",
"chai": "^4.2.0",
Expand All @@ -71,7 +71,7 @@
"sinon": "^7.5.0",
"sinon-chai": "^3.3.0",
"source-map-support": "^0.5.16",
"ts-node": "^8.5.0",
"ts-node": "^8.5.2",
"tslint": "^5.20.1",
"typescript": "^3.7.2"
}
Expand Down
6 changes: 3 additions & 3 deletions src/gzipUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {compress, decompress} from 'iltorb';
export const GZIP_MARKER = '__SQS_GZIP__';

export const compressMessage = <T>(message: string): Promise<string> => {
return compress(new Buffer(message))
return compress(Buffer.from(message))
.then((buffer): Promise<string> => {
return Promise.resolve(new Buffer(buffer).toString('base64'));
return Promise.resolve(Buffer.from(buffer).toString('base64'));
});
};

export const decompressMessage = (body: string): Promise<string> => {
return decompress(new Buffer(body, 'base64'))
return decompress(Buffer.from(body, 'base64'))
.then((bufferUnziped) => {
return Promise.resolve(bufferUnziped.toString('utf8'));
});
Expand Down
8 changes: 4 additions & 4 deletions src/test/src/Message.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ function getSQSMsg(body?: string): SQS.Message {
},
SomeBinary: {
DataType: 'Binary',
BinaryValue: new Buffer(['s']),
BinaryValue: Buffer.from(['s'.charCodeAt(0)]),
},
SomeCustomBinary: {
DataType: 'CustomBinary',
BinaryValue: new Buffer(['c']),
BinaryValue: Buffer.from(['c'.charCodeAt(0)]),
},
},
};
Expand Down Expand Up @@ -102,8 +102,8 @@ describe('Message', () => {
msg.attributes.should.be.eql({
SomeNumber: 1,
SomeString: 's',
SomeBinary: new Buffer(['s']),
SomeCustomBinary: new Buffer(['c']),
SomeBinary: Buffer.from(['s'.charCodeAt(0)]),
SomeCustomBinary: Buffer.from(['c'.charCodeAt(0)]),
});
});
});
Expand Down

0 comments on commit e2942bb

Please sign in to comment.