
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@jc-rowland/sharefile-client-api
Advanced tools
Unofficial TypeScript/JavaScript client for the ShareFile API - upload, download, and manage files and folders
A TypeScript library for interacting with the ShareFile API. This package provides a simple and intuitive interface to perform operations on ShareFile items such as files and folders.
npm install @jc-rowland/sharefile-client-api
import ShareFileAPI from '@jc-rowland/sharefile-client-api';
// Create an API instance
const shareFileAPI = new ShareFileAPI({
subdomain: 'your-subdomain',
username: 'your-username',
password: 'your-password',
clientId: 'your-client-id',
clientSecret: 'your-client-secret'
});
// Authenticate
await shareFileAPI.connect();
// Now you're ready to use the API
const homeFolder = await shareFileAPI.getItem('home');
console.log(`Home folder name: ${homeFolder.Name}`);
const folderContents = await homeFolder.children();
folderContents.forEach(item => {
console.log(`${item.Name} (${item.id})`);
});
const documentsFolder = await shareFileAPI.getItem('/Personal Folders/Documents');
const files = await documentsFolder.children();
const folder = await shareFileAPI.getItem('folder-id');
const fileContent = 'Hello, ShareFile!';
const newFile = await folder.upload(fileContent, 'hello.txt');
console.log(`File uploaded: ${newFile.Name}`);
const file = await shareFileAPI.getItem('file-id');
const downloadLink = await file.download(true);
console.log(`Download link: ${downloadLink}`);
// Or download as a buffer
const downloadSpec = await file.download(false);
const buffer = await downloadSpec.waitAndDownload().then(chain => chain.toBuffer());
const file = await shareFileAPI.getItem('file-id');
await file.updateItem({
Name: 'Updated File Name.txt',
Description: 'This file has been updated.'
});
const file = await shareFileAPI.getItem('file-id');
const newParentFolder = await shareFileAPI.getItem('new-folder-id');
await file.move(newParentFolder.id);
const file = await shareFileAPI.getItem('file-id');
await file.delete();
const parentFolder = await shareFileAPI.getItem('parent-folder-id');
const newFolder = await parentFolder.createFolder('New Folder', 'Description of the new folder');
const folder = await shareFileAPI.getItem('folder-id');
await folder.rename('New Folder Name');
const searchResultObj = await shareFileAPI.searchItems('budget report');
searchResultObj.results.forEach(item => {
console.log(`Found: ${item.Name} (${item.id})`);
});
const folder = await shareFileAPI.getItem('folder-id');
const pdfFiles = await folder.children({
$filter: "endswith(Name, '.pdf') eq true"
});
const file = await shareFileAPI.getItem('file-id');
const shareLink = await file.createShareLink({
ExpirationDate: '2023-12-31',
RequireLogin: false
});
console.log(`Share link: ${shareLink.Uri}`);
const file = await shareFileAPI.getItem('file-id');
const versions = await file.getStream();
versions.forEach(version => {
console.log(`Version: ${version.CreationDate}`);
});
const folder = await shareFileAPI.getItem('folder-id');
const filesToUpload = [
{ name: 'file1.txt', content: 'Content 1' },
{ name: 'file2.txt', content: 'Content 2' }
];
for (const file of filesToUpload) {
await folder.upload(file.content, file.name);
}
const folder = await shareFileAPI.getItem('folder-id');
const files = await folder.children();
for (const file of files) {
const downloadSpec = await file.download(false);
const buffer = await downloadSpec.waitAndDownload().then(chain => chain.toBuffer());
// Process or save the buffer
}
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the GPL-3.0 License.
FAQs
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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.