Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
megajs-cli
Advanced tools
The CLI version of MEGAJS, inspired by megatools.
Work in progress: download, upload, list and mkdir should be working, but they're not fully tested. Also the following features aren't implemented: automatic thumbnail generation, loading configuration from a file and caching.
You can download a standalone binary or install from NPM using npm install -g megajs-cli
.
To make this tool easier to MEGA users the commands are the same of megatools, same with the arguments. Results differ: if it breaks some automation script open a issue.
But there is a difference: instead of having multiple executables this tool just have one. Instead of "megacommand" use "megajs command". Example: "megajs dl" instead of "megadl". You can use also the longer name, shown below, like "megajs download".
-u --username <email>
: account email-p --password <password>
: account password--no-ask-password
: don't prompt interactively for a password--proxy <url>
: proxy server to use, more info on request documentation--speed-limit <speed>
: limit download/upload speed, if no unit is specified it defaults to KiB/s--config <path>
: load configuration from a file--ignore-config-file
: ignore user's .megajsrc--version
: show package info then exitsDownloads shared files and folders
# downloads a test file to the current folder
megajs dl <shared file or folder>
megajs dl https://mega.nz/#!N90lwbqL!MkbqwNRYPF4uFCN35zetE3PHOzP-NQc20hasZxPg5k8
If a folder is specified each file will be downloaded. If the download file exists it will not be replaced.
Supported arguments:
--path <dir>
: directory to download to, defaults to current working directory, use -
for stdout--connections <num>
: the number of parallel connections, defaults to 4--no-progress
: do not report progress-c --continue
: continue an interrupted downloadYou can download single files in folders by specifing the file handle:
$ megajs ls --human --long --header "https://mega.nz/#F!ExampleE!xampleExampleExampleEx"
=============================================================
Handle Owner T Size Mod. Date Filename
=============================================================
HandleAA OwnerID 0 1.0 KiB 1970-01-01 00:00:00 example-1.txt
HandleZZ OwnerID 0 2.0 KiB 1970-01-01 00:00:00 example-2.txt
$ megajs dl "https://mega.nz/#F!ExampleE!xampleExampleExampleEx!HandleAA"
example-1.txt was downloaded
You can also use regular expressions and glob expressions, like wget:
-A acclist --accept acclist
: only download files which match the specified glob expression-R rejlist --reject rejlist
: don't download files which match the specified glob expression--accept-regex urlregex
: only download files which match the specified regular expression--reject-regex urlregex
: don't download files which match the specified regular expression--ignore-case
: ignore case when matching files$ megajs dl "https://mega.nz/#F!ExampleE!xampleExampleExampleEx" -A "*1.txt"
example-1.txt was downloaded
Uploads files to MEGA
# downloads a test file to the current folder
megajs put test.txt
Supported arguments:
--path <dir>
: directory to upload to, defaults to root directory--preview <path>
: upload custom preview image (JPEG 75%, maximum width and height = 1000px)--thumbnail <path>
: upload custom thumbnail image (JPEG 70%, 120x120px)--no-progress
: do not report progress--disable-previews
: disable automatic thumbnails and preview images generationNote that the underlining library don't support parallel connections when uploading, but pull requests adding this feature are appreciated.
Lists files in remote folders
# list all files from a user
megajs ls
# list files from a user folder
megajs ls /Root
# list files from a shared folder
megajs ls "https://mega.nz/#F!98NDUTDK!3GatsuNoLion-IsAmazing"
Supported arguments:
-h --human
: format size values instead of returning bytes-l --long
: long format, showing node handle, node owner, node type, size, modification date, then filename-h --header
: add an header to the result-n --names
: show file names instead of full paths and hide folders-R --recursive
: list all files and folders recursively, default when no path specifiedIn order to keep compatibility sharing functions are handled by this command:
-e --export
: export the selected file or folder-k --key <key>
: exported folder key (22 character string ending with A, Q, g or w)Creates a folder in MEGA
megajs mkdir "/Root/Example"
megajs mkdir "/Root/Example Folder"
Creating a folder in contacts isn't supported.
Uploads a thumbnail or preview image to a already uploaded file.
# Upload a thumbnail image
megajs thumbnail /Root/RemoteFile.ext thumbnail-image.jpg
# Upload a preview image
megajs preview /Root/RemoteFile.ext preview-image.jpg
The thumbnail and preview images follow the same rules as in the put command. Any file accepts thumbnails and preview images, so be creative.
Registration (megareg) and quota commands (megadf) aren't supported because the underlining library doesn't support it. Would be great if someone send a pull request adding those features.
File and folder removing (megarm), copying files (megacopy) and downloading files where logged in (megaget) aren't supported by now because the main focus by now is implementing functions that may help MEGA scripting, and seems those functions are less used on scripting than the others.
Maybe the current speed limit implementation will only reduce file writing speed, not download speed: this feature wasn't well tested and implemented yet.
This application don't validates images passed to preview and thumbnail commands. Try to follow the specifications for the images to avoid bugs in other clients.
Part of the CLI code was inspired on Firebase CLI by Firebase and WebTorrent CLI by WebTorrent, LLC, both MIT Licensed.
FAQs
MEGAJS CLI
The npm package megajs-cli receives a total of 0 weekly downloads. As such, megajs-cli popularity was classified as not popular.
We found that megajs-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.