Skip to content

Commit 3d97746

Browse files
authored
Merge pull request #9 from jtpio/fix-saving
Fix saving Notebooks
2 parents 08de642 + 861b0e7 commit 3d97746

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/drive.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,15 @@ export class FileSystemDrive implements Contents.IDrive {
145145

146146
const handle = await root.getFileHandle(localPath);
147147
const writable = await handle.createWritable({});
148+
149+
const format = options?.format;
148150
const content = options?.content;
149-
await writable.write(content);
151+
if (format === 'json') {
152+
const data = JSON.stringify(content, null, 2);
153+
await writable.write(data);
154+
} else {
155+
await writable.write(content);
156+
}
150157
await writable.close();
151158
return this.get(localPath);
152159
}

0 commit comments

Comments
 (0)