New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

file-cloud-storage

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-cloud-storage - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

examples/files/working.wav

6

package.json
{
"name": "file-cloud-storage",
"version": "1.1.0",
"version": "1.2.0",
"description": "A set of wrappers for S3 clients",

@@ -27,2 +27,3 @@ "keywords": [

"s3:upload": "node ./examples/upload.js",
"s3:upload-binary": "node ./examples/upload-binary.js",
"s3:upload-multipart": "node ./examples/upload-multipart.js"

@@ -32,4 +33,5 @@ },

"async": "^3.2.0",
"ibm-cos-sdk": "^1.7.0"
"ibm-cos-sdk": "^1.7.0",
"mime-types": "^2.1.27"
}
}

@@ -17,3 +17,3 @@ # File Cloud Storage

const { getContent, uploadText } = getS3Client('ibm', {
const { getContent, uploadBinary, uploadMultiPartFile, uploadText } = getS3Client('ibm', {
endpoint: '<endpoint>',

@@ -29,2 +29,4 @@ apiKeyId: '<apiKey>',

try {
await uploadBinary(bucket, 'test.mp3', 'test.mp3');
await uploadMultiPartFile(bucket, 'test.avi', 'test.avi');
await uploadText(bucket, fileName, 'test content');

@@ -31,0 +33,0 @@ const fileContent = await getContent(bucket, fileName);

const { S3 } = require('ibm-cos-sdk');
const fs = require('fs');
const mime = require('mime-types');
const timesSeries = require('async/timesSeries');
const readFile = require('./read-file');
module.exports = (credentials) => {

@@ -25,2 +28,14 @@ const s3Client = new S3(credentials);

},
uploadFile(bucketName, fileName, filePath) {
return new Promise((resolve, reject) => {
readFile(filePath)
.catch((err) => reject(err))
.then((fileText) => s3Client.putObject({
Bucket: bucketName,
Key: fileName,
Body: fileText,
ContentType: mime.contentType(filePath) || 'application/octet-stream',
}).promise().then(resolve).catch(reject));
});
},
uploadMultiPartFile(bucketName, fileName, filePath) {

@@ -27,0 +42,0 @@ return new Promise((resolve, reject) => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc