Skip to content

Commit

Permalink
🐛 Fixed fileops
Browse files Browse the repository at this point in the history
  • Loading branch information
aexol committed Sep 18, 2023
1 parent 311bc9b commit 976f490
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/editor/src/editor/menu/Tools/FileOperations.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import FileSaver from "file-saver";

export const useFileOperations = () => {
/**
* Save as graphql file
*/
const saveToFile = (name: string, content: string) => {
const filename = `${name}.gql`;
const file = new File([content], filename, {
type: "application/graphql",
});
FileSaver.saveAs(file, filename);
};
return {
saveToFile,
};
};

0 comments on commit 976f490

Please sign in to comment.