Interface MongoGridFsClient


public interface MongoGridFsClient
  • Method Details

    • delete

      Future<Void> delete(String id)
      Deletes a file by it's ID
      Parameters:
      id - the identifier of the file
      Returns:
      a future notified when the operation completes
    • readByFileName

      ReadStream<Buffer> readByFileName(String fileName)
      Read file by name to ReadStream
    • readByFileNameWithOptions

      ReadStream<Buffer> readByFileNameWithOptions(String fileName, GridFsDownloadOptions options)
      Read file by name to ReadStream with options
    • readById

      ReadStream<Buffer> readById(String id)
      Read file by id to ReadStream
    • downloadByFileName

      Future<Long> downloadByFileName(WriteStream<Buffer> stream, String fileName)
    • downloadByFileNameWithOptions

      Future<Long> downloadByFileNameWithOptions(WriteStream<Buffer> stream, String fileName, GridFsDownloadOptions options)
    • downloadById

      Future<Long> downloadById(WriteStream<Buffer> stream, String id)
    • downloadFile

      Future<Long> downloadFile(String fileName)
      Downloads a file.
      Parameters:
      fileName - the name of the file to download
      Returns:
      a future notified with the result
    • downloadFileAs

      Future<Long> downloadFileAs(String fileName, String newFileName)
      Downloads a file and gives it a new name.
      Parameters:
      fileName - the name of the file to download
      newFileName - the name the file should be saved as
      Returns:
      a future notified with the result
    • downloadFileByID

      Future<Long> downloadFileByID(String id, String fileName)
      Downloads a file using the ID generated by GridFs.
      Parameters:
      id - the GridFs Object ID of the file to download
      Returns:
      a future notified with the result
    • drop

      Future<Void> drop()
      Drops the entire file bucket with all of its contents
      Returns:
      a future notified when the operation completes
    • findAllIds

      Future<List<String>> findAllIds()
      Finds all file ids in the bucket
      Returns:
      a future notified with the result
    • findIds

      Future<List<String>> findIds(JsonObject query)
      Finds all file ids that match a query.
      Parameters:
      query - a bson query expressed as json that will be used to match files
      Returns:
      a future notified with the result
    • uploadByFileName

      Future<String> uploadByFileName(ReadStream<Buffer> stream, String fileName)
    • uploadByFileNameWithOptions

      Future<String> uploadByFileNameWithOptions(ReadStream<Buffer> stream, String fileName, GridFsUploadOptions options)
    • uploadFile

      Future<String> uploadFile(String fileName)
      Upload a file to gridfs
      Parameters:
      fileName - the name of the file to store in gridfs
      Returns:
      a future notified with the result
    • uploadFileWithOptions

      Future<String> uploadFileWithOptions(String fileName, GridFsUploadOptions options)
      Upload a file to gridfs with options
      Parameters:
      fileName - the name of the file to store in gridfs
      options - GridFsUploadOptions for specifying metadata and chunk size
      Returns:
      a future notified with the result
    • close

      void close()
      Close the client and release its resources