Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions __tests__/github.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//import * as assert from "assert";
//const assert = require('assert');
import * as assert from "assert";
import { text } from "stream/consumers";
import { mimeOrDefault, asset } from "../src/github";

describe("github", () => {
Expand All @@ -19,7 +18,7 @@ describe("github", () => {
assert.equal(name, "bar.txt");
assert.equal(mime, "text/plain");
assert.equal(size, 10);
assert.equal(data.toString(), "release me");
assert.equal(await text(data), "release me");
});
});
});
6 changes: 3 additions & 3 deletions src/github.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GitHub } from "@actions/github/lib/utils";
import { Config, isTag, releaseBody, alignAssetName } from "./util";
import { statSync, readFileSync } from "fs";
import { createReadStream, statSync, type ReadStream } from "fs";
import { getType } from "mime";
import { basename } from "path";

Expand All @@ -10,7 +10,7 @@ export interface ReleaseAsset {
name: string;
mime: string;
size: number;
data: Buffer;
data: ReadStream;
}

export interface Release {
Expand Down Expand Up @@ -145,7 +145,7 @@ export const asset = (path: string): ReleaseAsset => {
name: basename(path),
mime: mimeOrDefault(path),
size: statSync(path).size,
data: readFileSync(path),
data: createReadStream(path, "binary"),
};
};

Expand Down