index.jsView |
---|
23 | 23 … | } |
24 | 24 … | |
25 | 25 … | function idToHex(id) { |
26 | 26 … | var b64 = String(id).replace(/^[%#&]|\.[a-z0-9]*$/g, '') |
27 | | - return new Buffer(b64, 'base64').toString('hex') |
| 27 … | + return Buffer.from(b64, 'base64').toString('hex') |
28 | 28 … | } |
29 | 29 … | |
30 | 30 … | function onceify(fn, self) { |
31 | 31 … | var cbs = [], err, data |
780 | 780 … | catch (e) {} |
781 | 781 … | if (self.req.headers['if-none-match'] === id) return self.respondRaw(304) |
782 | 782 … | self.server.getMsg(id, function (err, msg) { |
783 | 783 … | if (err) return self.respondError(500, err.message || err) |
784 | | - var out = new Buffer(JSON.stringify(msg, null, 2), 'utf8') |
| 784 … | + var out = Buffer.from(JSON.stringify(msg, null, 2), 'utf8') |
785 | 785 … | self.res.writeHead(200, { |
786 | 786 … | 'Content-Type': 'application/json', |
787 | 787 … | 'Cache-Control': 'public, max-age=315360000', |
788 | 788 … | 'Content-Length': out.length, |
1008 | 1008 … | var links = {} |
1009 | 1009 … | var done = multicb() |
1010 | 1010 … | function addAttachmentAsBlob(filename, cb) { |
1011 | 1011 … | var data = attachments[filename].data |
1012 | | - var tarball = new Buffer(data, 'base64') |
| 1012 … | + var tarball = Buffer.from(data, 'base64') |
1013 | 1013 … | var length = attachments[filename].length |
1014 | 1014 … | if (length && length !== tarball.length) return self.respondError(400, |
1015 | 1015 … | 'Length mismatch for attachment \'' + filename + '\'') |
1016 | 1016 … | self.server.sbot.blobs.add(function (err, id) { |