Fix deprecation warnings

This commit is contained in:
Petr Sloup
2019-12-30 17:18:05 +01:00
parent 13ad268b43
commit 226b979592
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ module.exports = (options, repo, params, id, styles, publicUrl) => {
} else { } else {
if (tileJSON['format'] === 'pbf') { if (tileJSON['format'] === 'pbf') {
isGzipped = data.slice(0, 2).indexOf( isGzipped = data.slice(0, 2).indexOf(
new Buffer([0x1f, 0x8b])) === 0; Buffer.from([0x1f, 0x8b])) === 0;
if (options.dataDecoratorFunc) { if (options.dataDecoratorFunc) {
if (isGzipped) { if (isGzipped) {
data = zlib.unzipSync(data); data = zlib.unzipSync(data);
+2 -2
View File
@@ -49,7 +49,7 @@ const extensionToFormat = {
* string is for unknown or unsupported formats. * string is for unknown or unsupported formats.
*/ */
const cachedEmptyResponses = { const cachedEmptyResponses = {
'': new Buffer(0) '': Buffer.alloc(0)
}; };
/** /**
@@ -82,7 +82,7 @@ function createEmptyResponse(format, color, callback) {
color = new Color(color); color = new Color(color);
const array = color.array(); const array = color.array();
const channels = array.length === 4 && format !== 'jpeg' ? 4 : 3; const channels = array.length === 4 && format !== 'jpeg' ? 4 : 3;
sharp(new Buffer(array), { sharp(Buffer.from(array), {
raw: { raw: {
width: 1, width: 1,
height: 1, height: 1,