
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
mailru-cloud
Advanced tools
Node.js library for Mail.ru Cloud storage via WebDAV API – upload, download and manage files with ease!
mailru-cloud is a lightweight Node.js library that simplifies working with Mail.ru Cloud storage using the WebDAV API. It provides an easy-to-use interface for uploading, downloading, managing files, and organizing folders in your Mail.ru Cloud account.
Before using the library, you'll need to generate an application-specific password for Mail.ru Cloud. Here's how:
Install the package using npm or yarn:
npm install mailru-cloud
# or
yarn add mailru-cloud
Import the library and initialize the client using MailRuCloud
:
import { MailRuCloud } from 'mailru-cloud'
const cloud = new MailRuCloud({
username: 'your_email@mail.ru', // Full email address
password: 'your_application_password', // Generated password
})
Use the upload
method to upload files to your Mail.ru Cloud:
import { createReadStream } from 'fs'
await cloud.file.upload(
createReadStream('./local_file.txt'),
'/cloud_directory/file.txt'
)
Download files from Mail.ru Cloud using the download
method:
import { createWriteStream } from 'fs'
const fileStream = await cloud.file.download('/cloud_directory/file.txt')
fileStream.pipe(createWriteStream('./downloaded_file.txt'))
The find
method allows you to search for specific files based on their names, ETags, or other criteria. Both filename
and etag
parameters are optional, allowing flexible searches based on one or both criteria. Here's how to use it:
const foundFile = await cloud.file.find({
filename: 'example.txt', // Search by filename
etag: '12345', // Optional: Search by ETag
folderPath: '/cloud_directory/', // Specify the starting directory
recursive: true, // Enable recursive search
sensitive: false, // Case-insensitive search
})
console.log(foundFile) // Output the result
filename
(optional): The name of the file you're searching for. Can be combined with etag
for precise searches.etag
(optional): An ETag for the file, which can help identify the latest version. Can be used alone or together with filename
.folderPath
(default: /
): The directory where the search starts.recursive
(default: false
): Whether to perform a recursive search through subdirectories.sensitive
(default: false
): Whether the search should be case-sensitive.Move files within your Mail.ru Cloud using the move
method:
await cloud.file.move('/current_path/file.txt', '/new_path/file.txt')
Copy files within your Mail.ru Cloud using the copy
method:
await cloud.file.copy('/original_path/file.txt', '/duplicate_path/file.txt')
Remove files from your Mail.ru Cloud using the remove
method:
await cloud.file.remove('/path_to_delete/file.txt')
Use the create
method to create new directories:
await cloud.folder.create('new_folder', '/parent_directory/')
List the contents of a directory using the list
method:
const folderContents = await cloud.folder.list('/parent_directory/')
console.log(folderContents)
Delete directories recursively using the delete
method:
await cloud.folder.delete('/parent_directory/new_folder/')
If you're experiencing issues with authentication or file operations, double-check that you've correctly generated and used your application-specific password. Also ensure that the paths specified are correct and that the requested actions align with the limitations imposed by Mail.ru Cloud's WebDAV API.
This project is licensed under the MIT License—see the LICENSE file for more information.
FAQs
Node.js library for Mail.ru Cloud storage via WebDAV API – upload, download and manage files with ease!
The npm package mailru-cloud receives a total of 9 weekly downloads. As such, mailru-cloud popularity was classified as not popular.
We found that mailru-cloud demonstrated a healthy version release cadence and project activity because the last version was released less than 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
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.