azu / azu/har-extractor

unable to create a subdirectory as a file was created before by script itself

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
Type: Bug
Dominant language
TypeScript
Stars
133
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Hi, here is the end of the log :

```
unpkg.com/shiki@0.14.1
Error: ENOTDIR: not a directory, mkdir '/home/fabien/Prototypes/har-offline/unpkg.com/shiki@0.14.1/dist'
at Object.mkdirSync (node:fs:1400:3)
at make (/usr/lib/node_modules/har-extractor/node_modules/make-dir/index.js:61:12)
at module.exports.sync (/usr/lib/node_modules/har-extractor/node_modules/make-dir/index.js:84:9)
at /usr/lib/node_modules/har-extractor/lib/har-extractor.js:48:21
at Array.forEach ()
at extract (/usr/lib/node_modules/har-extractor/lib/har-extractor.js:41:28)
at Object. (/usr/lib/node_modules/har-extractor/bin/cmd.js:51:5)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32) {
errno: -20,
syscall: 'mkdir',
code: 'ENOTDIR',
path: '/home/fabien/Prototypes/har-offline/unpkg.com/shiki@0.14.1/dist'
}
```

Files and directories until that point were created properly. If I check

```
fabien@fabien-CORSAIR-ONE-i160:~/Prototypes/har-offline$ ls unpkg.com/shiki@0.14.1 -l
-rw-rw-r-- 1 fabien fabien 107488 apr 2 09:50 unpkg.com/shiki@0.14.1
```

seems to be a file, not a directory. Maybe it's due to redirections.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/har-extractor.js around extract and bin/cmd.js, then reproduce the command using a HAR containing the shown shiki@0.14.1 paths. Done means the CLI no longer fails with ENOTDIR when an earlier extraction output is a file, with the relevant extraction behavior verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.