Store files for certain interval of time


#1

I’m trying to add demo functionality in my app in which user can upload file without sign in / up. Whatever one uploads, should not get store in database, instead file must get store somewhere else, say, in tmp directory and after certain interval of time file must get deleted from folder / directory, say after 24 hours.

Currently, to upload file I’m using cfs:uploader package and storing using fs.collection (with sign in /out functionality)

Please guide how can I do that

gStore = new FS.Store.FileSystem("modelFiles", {
    transformWrite: function(fileObj, readStream, writeStream)
    {
	var fileId = fileObj._id;
	Meteor.call('convertFile', fileId, function(err) {
	     if (err) {
		throw (new Meteor.Error('590', err.reason));	
 	    } 	
	});	   
	readStream.pipe(writeStream); 
    } 
});

ModelFiles = new FS.Collection("modelFiles", {
    stores: [ gStore ]
});