Skip to content

Commit 54c05be

Browse files
authored
✨ Feature: support upload buffer (#152)
Co-authored-by: tong <lbuchiyu@gmail.com>
1 parent 30ee4fc commit 54c05be

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/plugins/transformer/path.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ const handle = async (ctx: IPicGo): Promise<IPicGo> => {
1010
const results: IImgInfo[] = ctx.output
1111
await Promise.all(ctx.input.map(async (item: string, index: number) => {
1212
let info: IPathTransformedImgInfo
13-
if (isUrl(item)) {
13+
if (Buffer.isBuffer(item)) {
14+
info = {
15+
success: true,
16+
buffer: item,
17+
fileName: 'temporary.png',
18+
extname: '.png'
19+
}
20+
} else if (isUrl(item)) {
1421
info = await getURLFile(item, ctx)
1522
} else {
1623
info = await getFSFile(item)

0 commit comments

Comments
 (0)