Skip to content

Commit

Permalink
✨ Feature: support upload buffer (#152)
Browse files Browse the repository at this point in the history
Co-authored-by: tong <lbuchiyu@gmail.com>
  • Loading branch information
zangguojun and tong authored Aug 26, 2023
1 parent 30ee4fc commit 54c05be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/transformer/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ const handle = async (ctx: IPicGo): Promise<IPicGo> => {
const results: IImgInfo[] = ctx.output
await Promise.all(ctx.input.map(async (item: string, index: number) => {
let info: IPathTransformedImgInfo
if (isUrl(item)) {
if (Buffer.isBuffer(item)) {
info = {
success: true,
buffer: item,
fileName: 'temporary.png',
extname: '.png'
}
} else if (isUrl(item)) {
info = await getURLFile(item, ctx)
} else {
info = await getFSFile(item)
Expand Down

0 comments on commit 54c05be

Please sign in to comment.