mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-23 11:36:55 -04:00
🎞 Save all animated frames to bitmaps dir
This commit is contained in:
parent
af3440fa3a
commit
04c6b3936b
1 changed files with 15 additions and 0 deletions
15
packages/common/src/utils/saveFrames.ts
Normal file
15
packages/common/src/utils/saveFrames.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { Frames } from "../types";
|
||||
|
||||
interface SaveFramesArgs {
|
||||
frames: Frames;
|
||||
bitmapsDir: string;
|
||||
}
|
||||
|
||||
export const saveFrames = ({ frames, bitmapsDir }: SaveFramesArgs) => {
|
||||
for (let [fileName, { buffer }] of Object.entries(frames)) {
|
||||
const out_path = path.resolve(bitmapsDir, fileName);
|
||||
fs.writeFileSync(out_path, buffer, { encoding: "binary" });
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue