Skip to content

Commit 60531e4

Browse files
new Buffer() is deprecated. Switched to Buffer.from() instead
1 parent 9f69f08 commit 60531e4

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/parsers/binary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = {
4949
}
5050
else {
5151
// This will reject if data is anything other than a string or typed array
52-
return new Buffer(file.data);
52+
return Buffer.from(file.data);
5353
}
5454
}
5555
};

lib/resolvers/http.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function download (u, httpOptions, redirects) {
119119
}
120120
}
121121
else {
122-
resolve(res.body || new Buffer(0));
122+
resolve(res.body || Buffer.alloc(0));
123123
}
124124
})
125125
.catch((err) => {
@@ -163,10 +163,10 @@ function get (u, httpOptions) {
163163
req.on("error", reject);
164164

165165
req.once("response", (res) => {
166-
res.body = new Buffer(0);
166+
res.body = Buffer.alloc(0);
167167

168168
res.on("data", (data) => {
169-
res.body = Buffer.concat([res.body, new Buffer(data)]);
169+
res.body = Buffer.concat([res.body, Buffer.from(data)]);
170170
});
171171

172172
res.on("error", reject);

0 commit comments

Comments
 (0)