npm.io
0.1.2 • Published 5 years ago

storage-selectel

Licence
—
Version
0.1.2
Deps
1
Size
18 kB
Vulns
0
Weekly
0
Stars
1

storage-selectel npm version

import StorageSelectel from 'storage-selectel'

const storage = new StorageSelectel({
  user: process.env.USER,
  password: process.env.PASSWORD,
  container: 'master'
})


// upload to main container folder
storage.uploadFile({
  path: 'photo.png'
  body: fs.createReadStream('photo.png')
})

// upload to the folder in container
storage.uploadFile({
  path: 'folder/photo.png'
  body: fs.createReadStream('photo.png')
})

// upload to the subfolder in container
storage.uploadFile({
  path: 'folder/subfolder/photo.png'
  body: fs.createReadStream('photo.png')
})

// upload to the folder in specific container 
storage.uploadFile({
  container: 'slave',
  path: 'photo.png',
  body: fs.createReadStream('photo.png')
})

// get all files in container
storage.getContainerFiles()

// get all files in the folder container
storage.getContainerFiles({
  path: 'folder'
})

// get all files in the subfolder container
storage.getContainerFiles({
  path: 'folder/subfolder'
})

// get all files in the specific container
storage.getContainerFiles({
  container: 'slave'
})

Keywords