Skip to content

Commit

Permalink
fix: use Buffer.from instead of deprecated new Buffer
Browse files Browse the repository at this point in the history
Resolves an error during attachment import

```
(node:563578) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
```
  • Loading branch information
rhamzeh authored and vHanda committed Aug 26, 2021
1 parent 0dc8226 commit e4aec7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ function generateAttachment(a: string) {
var matches = a.substr(0, 100).match(regex);
var ext = matches[1];
var data = a.substr(a.indexOf("base64") + 7);
var buffer = new Buffer(data, "base64");
var buffer = Buffer.from(data, "base64");
return [uuidV4() + "." + ext, buffer];
}

0 comments on commit e4aec7d

Please sign in to comment.