MongoMediaProvider Class
A media provider that uses Mongo's GridFS as the method of storage.
Constructor
MongoMediaProvider
-
context
Parameters:
-
context
Object-
site
String
-
Methods
createWriteStream
-
mediaPath
-
cb
Not Implemented
Parameters:
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and a WriteableStream.
delete
-
mediaPath
-
cb
Deletes a file from the GridFS
Parameters:
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and the success of the operation.
exists
-
mediaPath
-
cb
Checks to see if the file actually exists in GridFS
Parameters:
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and a Boolean.
get
-
mediaPath
-
cb
Retrieves the content from GridFS as a String or Buffer.
Parameters:
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and an entity that contains the media content.
getStream
-
mediaPath
-
[options]
-
cb
Retrieves the item in GridFS as a stream.
Parameters:
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
[options]
Object optionalOptions for interacting with S3
-
[bucket]
String optionalThe S3 bucket to interact with
-
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and a ReadableStream that contains the media content.
setStream
-
stream
-
mediaPath
-
cb
Sets media content into GridFS based on the specified media path and options. The stream provided must be a ReadableStream.
Parameters:
-
stream
ReadableStreamThe content stream
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and the success of the operation.
setStream
-
fileDataStrOrBuffOrStream
-
mediaPath
-
cb
Sets media content into GridFS based on the specified media path and options. The data must be in the form of a String or Buffer.
Parameters:
-
fileDataStrOrBuffOrStream
String | BufferThe content to persist
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and the success of the operation.
stat
-
mediaPath
-
cb
Retrieve the stats on the file
Parameters:
-
mediaPath
StringThe path/key to the media. Typically this is a path such as: /media/2014/9/540a3ff0e30ddfb9e60000be-1409957872680.jpg
-
cb
FunctionA callback that provides two parameters: An Error, if occurred and an object that contains the file stats