How to create a dir with `fromJSON` without using a temp file?
See original GitHub issuemock-fs
supports a nested structure and represents empty dirs as empty objects.
At present I am using the flat
module to take a nested structure into fromJSON
, but there seems no way to create dirs without dummy files.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Generate temporary file names without creating actual file in ...
better way to create a temp directory is temp_dir = tempfile.mkdtemp(prefix='some-prefix_') which will safely create a temporary directory and return a string ...
Read more >Spark Read and Write JSON file into DataFrame
Spark SQL also provides a way to read a JSON file by creating a temporary view directly from reading file using spark.
Read more >Read/Write JSON Files with Node.js | heynode.com
Learn to use fs module to interact with the filesystem; Persist data to a JSON file; Use JSON.parse and JSON.stringify to convert data...
Read more >JSON Files - Spark 3.3.1 Documentation
Property Name Default Scope
primitivesAsString false read
prefersDecimal false read
allowComments false read
Read more >Display Records or Data From JSON File in React - YouTube
Use map to display records from JSON file in ReactJS. You can use data in object form in a JSON file and then...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@alex996 while it does technically work at runtime, I think the types should remain as requiring
null
because using{}
naturally leads to assuming{ '/some-dir': { '/some-nested-dir': {} } }
would work, which it doesn’t (for that you need to callfromNestedJSON
), and because{}
in TS actually means an open object, so it makes it a bit of a footgun & technically a breaking change if we wanted to say mergefromJSON
&fromNestedJSON
.Can be done now using
{}
object literal: