mirror of
https://github.com/outline/outline.git
synced 2026-11-21 21:44:30 +03:00
fix: self review
This commit is contained in:
1 parent
1660036227
commit
5ebbfc6e10
2 files changed
+6
-5
No files matched your search
@@ -10,6 +10,7 @@ import {
|
||||
import { mkdir, unlink } from "fs/promises";
|
||||
import path from "path";
|
||||
import { Readable } from "stream";
|
||||
import invariant from "invariant";
|
||||
import JWT from "jsonwebtoken";
|
||||
import env from "@server/env";
|
||||
import Logger from "@server/logging/Logger";
|
||||
@@ -97,6 +98,11 @@ export default class LocalStorage extends BaseStorage {
|
||||
};
|
||||
|
||||
public getFileStream(key: string) {
|
||||
invariant(
|
||||
env.FILE_STORAGE_LOCAL_ROOT_DIR,
|
||||
"FILE_STORAGE_LOCAL_ROOT_DIR is required"
|
||||
);
|
||||
|
||||
const filePath = path.join(env.FILE_STORAGE_LOCAL_ROOT_DIR, key);
|
||||
return createReadStream(filePath);
|
||||
}
|
||||
|
||||
@@ -175,11 +175,6 @@ export default class S3Storage extends BaseStorage {
|
||||
}
|
||||
|
||||
public async getFileBuffer(key: string) {
|
||||
invariant(
|
||||
env.AWS_S3_UPLOAD_BUCKET_NAME,
|
||||
"AWS_S3_UPLOAD_BUCKET_NAME is required"
|
||||
);
|
||||
|
||||
const stream = this.getFileStream(key);
|
||||
return new Promise<Buffer>((resolve, reject) => {
|
||||
const chunks: Buffer[] = [];
|
||||
|
||||
Reference in new issue
Block a user