mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
Reorganize file utilities and rename standardUpload to putObject
This commit is contained in:
parent
6dc375bb9c
commit
d078a91ab5
@ -1,12 +1,11 @@
|
||||
import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
|
||||
import { fileTypeFromBuffer } from "file-type"
|
||||
import readChunk from "@utils/readChunk"
|
||||
|
||||
import readChunk from "@shared-utils/readChunk"
|
||||
import getFileHash from "@shared-utils/readFileHash"
|
||||
import putObject from "./putObject"
|
||||
|
||||
import putObject from "./putObject"
|
||||
import Transformation from "../Transformation"
|
||||
|
||||
export type FileHandlePayload = {
|
||||
|
@ -2,7 +2,7 @@ import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
import pMap from "p-map"
|
||||
|
||||
export default async function standardUpload({
|
||||
export default async function putObject({
|
||||
filePath,
|
||||
uploadPath,
|
||||
metadata = {},
|
||||
@ -25,7 +25,7 @@ export default async function standardUpload({
|
||||
}
|
||||
})
|
||||
|
||||
await pMap(files, standardUpload, {
|
||||
await pMap(files, putObject, {
|
||||
concurrency: 3,
|
||||
})
|
||||
|
||||
|
@ -3,7 +3,7 @@ import fs from "node:fs"
|
||||
|
||||
import { checkChunkUploadHeaders, handleChunkFile } from "@classes/ChunkFile"
|
||||
import Upload from "@classes/Upload"
|
||||
import bufferToStream from "@utils/bufferToStream"
|
||||
import bufferToStream from "@shared-utils/bufferToStream"
|
||||
|
||||
const availableProviders = ["b2", "standard"]
|
||||
|
||||
|
7
packages/server/utils/readChunk.d.ts
vendored
Normal file
7
packages/server/utils/readChunk.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
export default function readChunk(
|
||||
filePath: string,
|
||||
options: {
|
||||
length: number
|
||||
startPosition: number
|
||||
},
|
||||
): Promise<Uint8Array>
|
Loading…
x
Reference in New Issue
Block a user