osos
an openstack object-storage client for browser
usage
creating a client
var client = new osos.Client({
baseUrl: "http://object-storage.com/v1/project",
token: "token"
});uploading
uploading large file
var promise = client.upload(file, container, {
sliceSize: 2, // Mb
concurrency: 2,
retry: 3
});
promise.then(function() {
console.log("done");
});uploading small file
client.directUpload(file, container);progress
client.upload(file, container, {
onProgress: function(progress) {
console.log(progress);
}
})more api
client.listContainers();
client.listOjbects(container);
client.delObject(container, object);examples
working in progress examples included, reactjs is required(run bower install)
a proxy is also needed, nginx can be configured as following:
server {
listen 8000;
root /path/to/osos/;
client_max_body_size 20M;
location /v1 {
proxy_pass http://object-storage:8080;
}
}after nginx is setup, visit localhost:8000/examples/list.html and localhost:8000/examples/upload.html
building osos.js
just run:
gulp