@nexys/swifts3-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

Swift/S3 Typescript client

npm version Build and Test Package Publish Code style

Only tested with Infomaniak Public cloud (OpenStack)

Migrate from a folder

See python code below

import os
import requests

directory = '.'
files = os.listdir(directory)

token = 'xxx'
swiftUrl = "https://s3.pub1.infomaniak.cloud/object/v1/AUTH_xxx"
containerName = "xxx"


for i, file_path in enumerate(files):
  url = swiftUrl + '/' + containerName + '/' + file_path
  headers =  { "X-Auth-Token": token,
              'Content-Type': 'text/plain',
             'Content-Length': str(os.path.getsize(file_path))
             }
  file = open(file_path, 'rb')
  file_data = file.read()
  #files = {'file': (file_path, file_data)}
  response = requests.put(url, headers=headers, data=file_data)
  print(file_path, os.path.basename(file_path), url, response)

Package Sidebar

Install

npm i @nexys/swifts3-client

Weekly Downloads

0

Version

0.0.10

License

MIT

Unpacked Size

12.3 kB

Total Files

16

Last publish

Collaborators

  • nexys