use fs.createReadStream instead of readFileSync

This commit is contained in:
ptaylor 2022-08-26 16:54:42 -07:00
parent cd28b0f5ee
commit ceb4b9ba8c

View file

@ -1,7 +1,7 @@
import fetch from "node-fetch"; import fetch from "node-fetch";
import { GitHub } from "@actions/github/lib/utils"; import { GitHub } from "@actions/github/lib/utils";
import { Config, isTag, releaseBody } from "./util"; import { Config, isTag, releaseBody } from "./util";
import { statSync, readFileSync } from "fs"; import { statSync, createReadStream } from "fs";
import { getType } from "mime"; import { getType } from "mime";
import { basename } from "path"; import { basename } from "path";
@ -11,7 +11,7 @@ export interface ReleaseAsset {
name: string; name: string;
mime: string; mime: string;
size: number; size: number;
data: Buffer; data: NodeJS.ReadableStream;
} }
export interface Release { export interface Release {
@ -128,7 +128,7 @@ export const asset = (path: string): ReleaseAsset => {
name: basename(path), name: basename(path),
mime: mimeOrDefault(path), mime: mimeOrDefault(path),
size: statSync(path).size, size: statSync(path).size,
data: readFileSync(path) data: createReadStream(path)
}; };
}; };