- Patched rock-req options initialisation
- Updated package
rock-req
to5.1.3
- Updated to a singleton pattern: the
require('tiny-storage-client')({ config-S3-or-SWIFT })
return a new storage instance. Meaning, existing instances are not overwritten anymore when creating a new one.
- Updated package
rock-req
to5.1.2
- Patched loading module
xmlToJson.js
- Updated setting defaults of rock-req by propagating the object instead of assigning.
- Updated package
rock-req
to5.1.1
- Added the possibility to set defaults rock-req values:
- Added function
setRockReqDefaults
andgetRockReqDefaults
- Or create the global variable
global.rockReqConf
, it must be initialised before callingrequire('tiny-storage-client')
- Added function
- Added for all S3 methods: the options argument can takes the option
requestOptions
object, it will be merged into the HTTP request options. Example to upload a file:storage.uploadFile('bucket', 'file.pdf', Buffer.from(fileXml), { requestOptions: { tenantId: 200, headers: { "custom-option" : true } } }, (err, resp) => {})
- Replaced
simple-get
byrock-req
package (0 deps, bench: 21797 req/s and streams fully tested) - To download a file as stream, you have to provide an
output
function as option. Theoutput
function must return the output stream, and it is invoked byrock-req
for every request and retries. If something goes wrong, the Writable stream is destroyed automatically, and the error can be captured with 'error' event orstream.finished
. When the callback is called, the streamed is finised. Thestream:true
boolean options to get an HTTP response a Stream is removed, and replaced by theoutput: () => { return OutputStream }
option (Explained above).
- Fixed Bucket aliases generating a false AWS4 signature
- Removed unused code
- Updated documentation
- Renamed the project "high-availability-object-storage" to "tiny-storage-client"
- Added support for AWS s3, learn more to connect and request
- the
request
function accept an optionstream:true
to get the HTTP response as a stream, instead of a content as Buffer, such as:request(method, path, { headers, queries, body, stream: true }, (err, resp) => {})
. - Removed
debug
package
- Add function to create custom request to the object storage. Prototype:
request(method, path, { headers, queries, body }, (err, body, headers) => {})
. The base URL requests by default the account, passing an empty string will request the account details. For container requests, pass the container name, such as:/{container}
. For file requests, pass the container and the file, such as:/{container}/{filename}
. Object Storage Swift API specification: https://docs.openstack.org/api-ref/object-store/
- Add function
setFileMetadata
to create or replace object metadata - Add function
getFileMetadata
to get an object metadata - Updated package
debug
to4.3.4
- Updated package
simple-get
to4.0.1
- Fixed the
downloadFile
callback function, the third argument is now always returning the response header of the request.
- Added
setLogFunction
used to Override the log function. It takes to arguments:message
as a string,level
as a string and can be:info
/warning
/error
. Example to use:
storage.setLogFunction((message, level) => {
console.log(`${level} : ${message}`);
})
- Fixed
connection
fallback on error & add tests
- Fixed
uploadFile
: return the response body if an error occurs - Added parallel tests
- Fix the automatic fallback when multiple clients are using all functions in parallel
- Renamed
getFiles
function tolistFiles
- Renamed
writeFile
function touploadFile
- Renamed
readFile
function todownloadFile
- Added: Pass a list of object storage credential to the constructor, the sdk will automatically connect to another storage if something goes wrong (Server or DNS not responding, timeout, error 500, too many redirection, and more...)
- Added: the method
uploadFile
accepts a new optionnal fourth argumentoption
:{ queries: { temp_url_expires: '1440619048' }, headers: { X-Object-Meta-LocationOrigin: 'Paris/France' }
. List of query parameters and headers: https://docs.openstack.org/api-ref/object-store/?expanded=create-or-replace-object-detail#create-or-replace-object
- Added method
getFiles
: Show container details and list objects. It is possible to filter the list or overwrite the request headers, such as:List of headers and queries: https://docs.openstack.org/api-ref/object-store/?expanded=show-container-details-and-list-objects-detail#show-container-details-and-list-objectsstorage.getFiles('containerName', { queries: { prefix: 'prefixName' }, headers: { Accept: 'application/xml' } }, function (err, body) { if (err) { return console.log(err); } console.log(body.toString()); });
- Updated
writeFile
function : it can take a Buffer as an argument
- Methods to interact with the OVH Object Storage:
- writeFile: upload a file
- readFile: download a file
- deleteFile: delete a file
- a new authentication token is requested when the authentication token is not valid during a request