mafintosh / torrent-stream

The low level streaming torrent engine that peerflix uses
MIT License
1.94k stars 228 forks source link

Amazon AWS S3 #82

Closed johackim closed 10 years ago

johackim commented 10 years ago

Hello mafintosh,

I have a question for you ; It is technicaly possible to download files directly on amazon bucket S3 and not on system file ?

I try this :

var torrentStream = require('torrent-stream');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');

var s3 = new AWS.S3();
var engine = torrentStream('magnet:?xt=urn:btih:c0664234b44f25de6cc7b536a798c65f858079cb');

engine.on('download', function() {
    engine.files.forEach(function(file) {

        var stream = file.createReadStream();
        s3.putObject({Bucket: 'bucketname', Key: file.name, Body: stream});

    });
});

It's works, but i would like write on amazon s3 storage progressively and not after download finish. I imagine an option 'tmp' with path of amazon storage.

Thank you very much for your work.

mafintosh commented 10 years ago

you can actually implement an s3 storage (similar to https://github.com/mafintosh/torrent-individual-piece-storage) and pass that as the storage parameter