Skip to content

Commit

Permalink
Merge pull request #324 from busslina:rel-0-8
Browse files Browse the repository at this point in the history
Adding extraData argument to GridFs createFile method
  • Loading branch information
giorgiofran authored Mar 14, 2023
2 parents a13c13a + 6117437 commit bcf3b8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/src/gridfs/grid_in.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class GridIn extends GridFSFile {

/// Used for MD5 calculation, now deprecated
//Uint8List contentToDigest = Uint8List(0);
GridIn._(GridFS fs, String filename, Stream<List<int>> inputStream)
: super(fs) {
GridIn._(GridFS fs, String filename, Stream<List<int>> inputStream,
[Map<String, dynamic>? extraData])
: super(fs, extraData) {
id = ObjectId();
input = ChunkHandler(chunkSize).transformer.bind(inputStream);
uploadDate = DateTime.now();
Expand Down
5 changes: 3 additions & 2 deletions lib/src/gridfs/gridfs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class GridFS {
Future<GridOut?> getFile(String fileName) async =>
findOne(where.eq('filename', fileName));

GridIn createFile(Stream<List<int>> input, String filename) =>
GridIn._(this, filename, input);
GridIn createFile(Stream<List<int>> input, String filename,
[Map<String, dynamic>? extraData]) =>
GridIn._(this, filename, input, extraData);

/// **Beware!** This method removes all the documents in this bucket
Future<void> clearBucket() async {
Expand Down

0 comments on commit bcf3b8e

Please sign in to comment.