feat(edit-docs): automatically write documentation on start-up

This commit is contained in:
Elian Doran
2025-03-10 16:20:48 +02:00
parent 2530c01a31
commit df2a9aed44
2 changed files with 39 additions and 3 deletions

View File

@@ -605,7 +605,7 @@ function streamToBuffer(stream: Stream): Promise<Buffer> {
return new Promise((res, rej) => stream.on("end", () => res(Buffer.concat(chunks))));
}
function readContent(zipfile: yauzl.ZipFile, entry: yauzl.Entry): Promise<Buffer> {
export function readContent(zipfile: yauzl.ZipFile, entry: yauzl.Entry): Promise<Buffer> {
return new Promise((res, rej) => {
zipfile.openReadStream(entry, function (err, readStream) {
if (err) rej(err);
@@ -616,8 +616,8 @@ function readContent(zipfile: yauzl.ZipFile, entry: yauzl.Entry): Promise<Buffer
});
}
function readZipFile(buffer: Buffer, processEntryCallback: (zipfile: yauzl.ZipFile, entry: yauzl.Entry) => void) {
return new Promise((res, rej) => {
export function readZipFile(buffer: Buffer, processEntryCallback: (zipfile: yauzl.ZipFile, entry: yauzl.Entry) => Promise<void>) {
return new Promise<void>((res, rej) => {
yauzl.fromBuffer(buffer, { lazyEntries: true, validateEntrySizes: false }, function (err, zipfile) {
if (err) rej(err);
if (!zipfile) throw new Error("Unable to read zip file.");