
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@icapps/tree-house-storage
Advanced tools
NodeJS storage utility module written in Typescript
Install via npm
npm install @icapps/tree-house-storage
or via yarn
yarn add @icapps/tree-house-storage
Express middleware function to upload a local file using multer.
import { middleware } from '@icapps/tree-house-storage'
const options = {
destination: 'uploads',
fileSize: 12000,
allowedFileTypes: ['image/png', 'image/jpg'],
// Optional Joi schema validation for other body data
validator: {
schema: joiSchema,
options: joiOptions,
};
};
app.post('/upload', middleware.multipartUpload(options), ...);
Local file functions enabling the use of Promises for fs
methods.
Creates a folder if it doesn't exist already. (Asynchronous)
import { local } from '@icapps/tree-house-storage'
await local.createIfNotExists('/localFolder');
Creates a new local file. This will also create a folder when it does not exist already. (Asynchronous)
import { local } from '@icapps/tree-house-storage'
await local.createFile('/localFolder', 'myFile.txt', 'My personal content');
Read an existing local file via filepath. (Asynchronous)
import { local } from '@icapps/tree-house-storage'
await local.readFile('/localFolder', 'myFile.txt', 'My personal content');
Delete an existing local file via filepath (Asynchronous)
import { local } from '@icapps/tree-house-storage'
await local.deleteFile('/localFolder/myFile.txt');
Amazon S3 libs
Create an S3 client
import { amazon } from '@icapps/tree-house-storage'
const options = {
region: 'eu-west-1',
accessKeyId: 'myAccesKey',
secretAccessKey: 'mySecret',
};
const client = amazon.createClient(options);
Upload a file to S3
import { amazon } from '@icapps/tree-house-storage'
const options = {
path: 'localPath/localFile.png',
content: 'fileContent ...',
name: uuid.v4(),
contentType: 'image/png',
bucket: 's3bucketName',
key: 's3KeyName',
encryption: 'AE-256', // Optional encryption (this will enable server encryption on S3)
};
const { location, bucket, key } = await amazon.uploadFile(client, options);
Retrieve a file from S3
import { amazon } from '@icapps/tree-house-storage'
const { body } = await amazon.getFile(client, bucket, key);
Remove a file from S3
import { amazon } from '@icapps/tree-house-storage'
await amazon.removeFile(client, bucket, key);
Gets a pre-signed url for an S3 resource
import { amazon } from '@icapps/tree-house-storage'
const options = {
bucket: 's3bucketName',
key: 's3KeyName',
expires: 1600, // Optional expiration time
};
const { location, bucket, key } = await amazon.getPresignedUrl(client, options);
Gets a pre-signed upload url for an S3 resource
import { amazon } from '@icapps/tree-house-storage'
const options = {
bucket: 's3bucketName',
key: 's3KeyName',
expires: 1600, // Optional expiration time
contentType: 'image/png' // Optional but best practice to include this
};
const url = await amazon.getUploadPresignedUrl(client, options);
All tests are written using Jest. Check out the documentation here for more information.
You can run npm run test
to run all tests
You can run npm run test:coverage
to run all tests with coverage report
When you find issues, please report them:
Be sure to include all of the output from the npm command that didn't work as expected. The npm-debug.log file is also helpful to provide.
See the list of contributors who participated in this project.
This project is licensed under the ISC License - see the LICENSE.md file for details
FAQs
Tree House Storage
We found that @icapps/tree-house-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.