Adobe I/O CNA Storage SDK
A JavaScript abstraction on top of cloud blob storages exposing a file-system 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.
Install
npm install @adobe/adobeio-cna-cloud-storage
Use
const storageSDK = require('@adobe/adobeio-cna-cloud-storage')
const storage = await storageSDK.init({ ow: { namespace, auth } })
const storage = await storageSDK.init()
const storage = await storageSDK.init({ azure: { storageAccount, storageAccessKey, containerName } })
await storage.write('mydir/myfile.txt', 'some private content')
await storage.write('public/index.html', '<h1>Hello World!</h1>')
const props = await storage.getProperties('public/index.html')
props.url
await storage.list('/')
const buffer = await storage.read('mydir/myfile.txt')
buffer.toString()
const rdStream = await storage.createReadStream('mydir/myfile.txt')
const stream = rdStream.pipe(fs.createWriteStream('my-local-file.txt'))
stream.on('finish', () => console.log('done!'))
const rdStream = fs.createReadStream('my-local-file.txt')
await storage.write('my/remote/file.txt', rdStream)
await storage.delete('my/remote/')
await storage.delete('public/')
await storage.delete('/')
await storage.copy('my-static-app/', 'public/', { localSrc: true })
await storage.copy('public/my-static-app/', 'my-static-app-copy', { localDest: true })
await storage.copy('public/my-static-app/', 'my/private/folder')
Explore
goto
API
Contributing
Contributions are welcomed! Read the Contributing Guide for more information.
Licensing
This project is licensed under the Apache V2 License. See LICENSE for more information.