0.0.10 • Published 9 months ago

@nexys/swifts3-client v0.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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)
0.0.10

9 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.1

1 year ago