mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
14 lines
457 B
TypeScript
14 lines
457 B
TypeScript
|
|
import shim from '@joplin/lib/shim';
|
|
import { join, dirname } from 'path';
|
|
|
|
const createFilesFromPathRecord = async (baseDir: string, fileContents: Record<string, string>) => {
|
|
for (const relativePath in fileContents) {
|
|
const targetPath = join(baseDir, relativePath);
|
|
await shim.fsDriver().mkdir(dirname(targetPath));
|
|
await shim.fsDriver().writeFile(targetPath, fileContents[relativePath], 'utf-8');
|
|
}
|
|
};
|
|
|
|
export default createFilesFromPathRecord;
|