Interacting with the filesystem

Hey all!

I’d really like to use craft to write blog posts for my photo blog. My blog is generated via Hugo and hosted on firebase, so ideally the export process would be able to take the markdown of the current page, add the meta information at the top of the page, do some slight modifications to the syntax to utilize a few Hugo shortcodes I have, and collect all of the images into a directory.

This would all be pretty trivial if I could access the fs module but it appears that module is not usable in the craft extension environment. Any thoughts what could work instead?

Thanks,
Cameron

1 Like

I have the same scenario as you, I use Github Pages for my blog and there are some images in it that I will upload to CDN manually after writing the article, I hope to provide a file system so that I can automate the process of getting the image address and uploading to CDN in bulk after writing the article in Craft.

The api interface I expect would like: craft.file.makeDir & craft.file.makeFile & craft.file.readFile & craft.file.isDir & craft.file.isFile, etc, stream or buffer both support.