Skip to content

Commit 8d0eb18

Browse files
committed
buffer alloc.
1 parent d9384eb commit 8d0eb18

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/archivers/zip/zip-archive-output-stream.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ ZipArchiveOutputStream.prototype._writeCentralFileHeader = function(ae) {
313313
var extra = ae.getCentralDirectoryExtra();
314314

315315
if (gpb.usesUTF8ForNames()) {
316-
name = Buffer.alloc(name);
317-
comment = Buffer.alloc(comment);
316+
name = Buffer.from(name);
317+
comment = Buffer.from(comment);
318318
}
319319

320320
// name length
@@ -381,7 +381,7 @@ ZipArchiveOutputStream.prototype._writeLocalFileHeader = function(ae) {
381381
}
382382

383383
if (gpb.usesUTF8ForNames()) {
384-
name = Buffer.alloc(name);
384+
name = Buffer.from(name);
385385
}
386386

387387
ae._offsets.file = this.offset;

lib/util/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ util.normalizeInputSource = function(source) {
1818
if (source === null) {
1919
return Buffer.alloc(0);
2020
} else if (typeof source === 'string') {
21-
return Buffer.alloc(source);
21+
return Buffer.from(source);
2222
} else if (util.isStream(source) && !source._readableState) {
2323
var normalized = new PassThrough();
2424
source.pipe(normalized);

0 commit comments

Comments
 (0)