mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: 支持题目导出
This commit is contained in:
1 parent
a5004a7c1b
commit
ee0f5deedc
11 files changed
+87
-33
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import fs from 'fs';
|
||||
import { Duplex } from 'stream';
|
||||
import cluster from 'cluster';
|
||||
import path from 'path';
|
||||
import serialize from 'serialize-javascript';
|
||||
@@ -180,6 +181,13 @@ export function streamToBuffer(stream): Promise<Buffer> {
|
||||
});
|
||||
}
|
||||
|
||||
export function bufferToStream(buffer: Buffer): NodeJS.ReadableStream {
|
||||
const stream = new Duplex();
|
||||
stream.push(buffer);
|
||||
stream.push(null);
|
||||
return stream;
|
||||
}
|
||||
|
||||
export function buildProjection(fields: string[]): Record<string, 1> {
|
||||
const o = {};
|
||||
for (const k of fields) o[k] = 1;
|
||||
|
||||
Reference in new issue
Block a user