Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@adobe/adobeio-cna-cloud-storage
Advanced tools
An abstraction on top of blob cloud storage exposing a file like API
An abstraction on top of cloud blob storage exposing a file like API.
You can initialize the SDK with your Adobe I/O Runtime (a.k.a OpenWhisk) credentials.
Alternatively, you can bring your own cloud storage keys. Note however, that as of now we only support Azure Blob Storage. AWS S3 is the next on the todo list and will soon be available.
npm install @adobe/adobeio-cna-cloud-storage
const storageSDK = require('@adobe/adobeio-cna-cloud-storage')
// init sdk using OpenWhisk credentials
const storage = await storageSDK.init({ ow: { namespace, auth } })
// write private file
await storage.write('mydir/myfile.txt', 'some private content')
// write publicly accessible file
await storage.write('public/index.html', '<h1>Hello World!</h1>')
// get file url
const props = await storage.getProperties('public/index.html')
props.url
// list all files
await storage.list('/') // ['mydir/myfile.txt', 'public/index.html']
// read
const buffer = await storage.read('mydir/myfile.txt')
buffer.toString() // 'some private content'
// pipe read stream to local file
const rdStream = await storage.createReadStream('mydir/myfile.txt')
const stream = rdStream.pipe(fs.createWriteStream('my-local-file.txt'))
stream.on('finish', () => console.log('done!'))
// write read stream to remote file
const rdStream = fs.createReadStream('my-local-file.txt')
await storage.write('my/remote/file.txt', rdStream)
// delete files in 'my/remote/' dir
await storage.delete('my/remote/')
// delete all public files
await storage.delete('public/')
// delete all files including public
await storage.delete('/')
// copy
// upload local directory
await storage.copy('my-static-app/', 'public/', { localSrc: true })
// download to local directory
await storage.copy('public/my-static-app/', 'my-static-app-copy', { localDest: true })
// copy files around cloud storage
await storage.copy('public/my-static-app/', 'my/private/folder')
goto
API
Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.
FAQs
An abstraction on top of blob cloud storage exposing a file like API
The npm package @adobe/adobeio-cna-cloud-storage receives a total of 11 weekly downloads. As such, @adobe/adobeio-cna-cloud-storage popularity was classified as not popular.
We found that @adobe/adobeio-cna-cloud-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 48 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.