mscdex / node-ftp

An FTP client module for node.js
MIT License
1.13k stars 244 forks source link

[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues #255

Open baerrach opened 4 years ago

baerrach commented 4 years ago

Node is issues the warnings listed below.

These are cause by https://github.com/mscdex/node-ftp/blob/master/lib/connection.js#L53

See https://medium.com/@jasnell/node-js-buffer-api-changes-3c21f1048f97 for more information.

(node:19124) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
    at showFlaggedDeprecation (buffer.js:159:11)
    at new Buffer (buffer.js:174:3)
    at Object.<anonymous> (path/to/node_modules/ftp/lib/connection.js:52:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
samjegal commented 4 years ago

Same issue above. data-uri-to-buffer version set "1".

node_modules/get-uri/package.json
  "dependencies": {
    "data-uri-to-buffer": "1",
    "debug": "2",
    "extend": "~3.0.2",
    "file-uri-to-path": "1",
    "ftp": "~0.3.10",
    "readable-stream": "2"
  },
tutanra commented 4 years ago

I change mannually for
-> bytesNOOP = new Buffer.from('NOOP\r\n');

Same error appear with electron^9 and makes slow start.

frosas commented 3 years ago

https://github.com/mscdex/node-ftp/pull/230 fixes this