Migrate
From netstorageapi
The configuration object, method names, arguments and (err, response, body) callbacks match Akamai's netstorageapi, so in most code only the import changes.
- const Netstorage = require("netstorageapi");
+ const Netstorage = require("ts-netstorageapi-akamai").default;
| netstorageapi | ts-netstorageapi-akamai |
|---|---|
quick_delete(path, cb) | quickDelete(path, cb) |
| Callbacks only | Callbacks, plus …Async promise methods |
| File upload and download only | Plus uploadBuffer and downloadBuffer |
| No types | Types for config, methods and responses |
All other methods (dir, list, download, du, stat, mkdir, rmdir, mtime, delete, rename, symlink, upload) have the same names and arguments, and requests are signed the same way.
Then, optionally
- Move callbacks to promises one call at a time:
ns.stat(p, cb)becomesawait ns.statAsync(p). - Replace temporary files with
uploadBufferanddownloadBuffer. - Add types to your own code with the exported response types.