This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Jesse Campbell
Posted Feb 06 - Read on Facebook

Hello, Framer group! I'm totally caught on something and am looking for some help. I’m trying to get an array of all the JSON files in a "/data" folder, so I thought I’d use NPM glob but it’s giving me the following error:

"TypeError: fs.readdir is not a function. (In 'fs.readdir(abs, readdirCb(this, abs, cb))', 'fs.readdir' is undefined)"

My files look like so:

# File: modules/
exports.glob = require "glob"

# File: modules/
{glob} = require 'npm'
glob './data/*.json', (err, files) ->
# do things with files

# File:
data = require 'data'

To my understanding FS (file system) is included in NPM, but it seems like it can't access the functions. Any thoughts?