Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/classes/read-file.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { isReadableStream } from "../stream.js";

const ReadFile = class ReadFile {
constructor({ mimeType = "", etag = "" } = {}) {
constructor({ mimeType = "", etag = "", generation = "" } = {}) {
this._mimeType = mimeType;
// @ts-ignore
this._stream = undefined;
this._etag = etag;
this._generation = generation;
}

get mimeType() {
Expand All @@ -27,6 +28,15 @@ const ReadFile = class ReadFile {
return this._etag;
}

/**
* An opaque version token captured at read time. Pass this back to
* sink.write() as options.ifGenerationMatch to perform a compare-and-swap
* write that fails if another writer has modified the file in the meantime.
*/
get generation() {
return this._generation;
}

get [Symbol.toStringTag]() {
return "ReadFile";
}
Expand Down