
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
aliyun OSS(Open Storage Service) lib. A node wrapper for OSS RESTful API.
npm install kloud --save
First, create an OSS client:
var client = kloud.createClient({
accessKeyId: '<your access key id>',
accessKeySecret: '<your access key secret>',
host: '<your bucket host>', // region.aliyuncs.com
bucket: '<your bucket name>'
});
Use the Client#put(filename, headers) method with a string or buffer to upload some strings to OSS, just like node http.Client request. Return a duplex stream, you can listen for a response event on it, and write the content using req.end(content).
var str = JSON.stringify({ foo: 'bar' });
var req = client.put('test.json', {
'Content-Type': 'application/json',
'Content-Length': str.length
});
req.on('response', function(res) {
if (res.statusCode === 200) {
console.log('file saved.');
}
});
req.end(str);
Use the Client#putFile(src, filename, headers, callback) to upload a file to OSS:
client.putFile('./README.md', 'readme.markdown', function(err, res) {
// res.statusCode === 200
});
Or use the Client#putStream(stream, filename, headers, callback):
http.get('http://google.com/doodle.png', function(res){
var headers = {
'Content-Length': res.headers['content-length'],
'Content-Type': res.headers['content-type']
};
client.putStream(res, 'doodle.png', headers, function(err, res){
// res.statusCode === 200
});
});
Important: use stream mode you have to set Content-Length header!
fs.stat('./README.md', function(err, stat) {
var headers = {
'Content-Length': stat.size,
'Content-Type': 'text/plain'
};
var req = client.put('readme.markdown', headers);
req.on('response', function(res) {
// res.statusCode === 200
});
fs.createReadStream('./README.md').pipe(req);
})
Also, you can use Client.putBuffer(buffer, filename, headers, callback) to put a string or buffer data:
var buf = new Buffer('hello world');
client.putBuffer(buf, 'test.txt', function(err, res) {});
Use the Client.get(filename, headers) to get an OSS object:
var req = client.get('readme.markdown');
req.on('response', function(res) {
// res.statusCode === 200
var chunks = [];
var chunkLen = 0;
res.on('data', function(chunk) {
chunks.push(chunk);
chunkLen += chunk.length;
});
res.on('end', function() {
console.log(Buffer.concat(chunks, chunkLen).toString());
});
});
Or use Client#getFile(filename, headers, callback):
client.getFile('readme.markdown', function(err, res) {
// res.statusCode === 200
var dest = fs.createWriteSteam('./test.md');
res.pipe(dest);
});
Use Client#del(filename, headers) to delete an OSS object:
client.del('readme.markdown').on('response', function(err, res) {
// res.statusCode === 200
// Deleted!
});
Or Client#deleteFile(filename, headers, callback):
client.deleteFile('readme.markdown', function(err, res) {});
You can delete up to 1000 OSS objects at once:
client.deleteMultiple(['test.json', 'readme.markdown'], function(err, res) {});
FAQs
aliyun OSS(Open Storage Service) lib.
The npm package kloud receives a total of 9 weekly downloads. As such, kloud popularity was classified as not popular.
We found that kloud demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.