Commit 514c401ff151036c45361377130d23877d57bec1
Avoid deprecated Buffer constructor
cel committed on 6/11/2020, 5:39:00 PMParent: df2a2ada6eb755c0b52aad076d8abdcf12c14ad5
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -29,9 +29,9 @@ | ||
29 | 29 … | var appHash = hash([fs.readFileSync(__filename)]) |
30 | 30 … | |
31 | 31 … | var urlIdRegex = /^(?:\/(([%&@]|%25|%26|%40)(?:[A-Za-z0-9\/+]|%2[Ff]|%2[Bb]){43}(?:=|%3[Dd])\.(?:sha256|ed25519))(?:\.([^?]*))?|(\/.*?))(?:\?(.*))?$/ |
32 | 32 … | |
33 | -var zeros = new Buffer(24); zeros.fill(0) | |
33 … | +var zeros = Buffer.alloc(24); zeros.fill(0) | |
34 | 34 … | |
35 | 35 … | function hash(arr) { |
36 | 36 … | return arr.reduce(function (hash, item) { |
37 | 37 … | return hash.update(String(item)) |
@@ -482,9 +482,9 @@ | ||
482 | 482 … | if (!has) return respond(res, 404, 'Not found') |
483 | 483 … | |
484 | 484 … | var unboxKey |
485 | 485 … | if (unbox) { |
486 | - try { unboxKey = new Buffer(unbox, 'base64') } | |
486 … | + try { unboxKey = Buffer.from(unbox, 'base64') } | |
487 | 487 … | catch(e) { return respond(res, 400, err.message) } |
488 | 488 … | if (unboxKey.length !== 32) return respond(res, 400, 'Bad blob key') |
489 | 489 … | } |
490 | 490 … |
Built with git-ssb-web