Unlink file an its subversions from FS.
This is low-level method. You shouldn't use it, unless you know what you're doing.
Unlike fs.remove
if callback
is not specified method wouldn't throw an exception on error.
fileRef
{Object} - FullfileRef
object, returned fromFilesCollection.findOne().get()
version
{String} - [Optional] If specified, only subversion will be unlinkedcallback
{Function} - [Optional] Triggered after file is removed. If cursor has multiple files, will be triggered for each file. If file has multiple subversions, will be triggered for each version.- Returns {FilesCollection} - Current FilesCollection instance
import { FilesCollection } from 'meteor/ostrio:files';
const imagesCollection = new FilesCollection({collectionName: 'images'});
imagesCollection.unlink(Images.collection.findOne({}));
// OR:
imagesCollection.unlink(Images.collection.findOne({}), 'thumbnail');