mihneadb / node-directory-tree

Convert a directory tree to a JS object.
MIT License
523 stars 106 forks source link

Windows 11, latest, gettting children [Array] #107

Closed born2net closed 2 years ago

born2net commented 2 years ago

running windows 11 node v14.17.5 script:


const PATH = require('path');
const dirTree = require('directory-tree');

const start = PATH.resolve(__dirname, '../../../Data/Upload/shared');

const tree = dirTree('./../../../Data/Stoicisim', {}, (item, PATH, stats) => {
  // console.log(item);
});

console.log(tree)

and children are coming as [Array]

{
  path: './../../../Data/Stoicisim',
  name: 'Stoicisim',
  children: [
    {
      path: '..\\..\\..\\Data\\Stoicisim\\quotes',
      name: 'quotes',
      children: [Array]
    },
    {
      path: '..\\..\\..\\Data\\Stoicisim\\simple',
      name: 'simple',
      children: [Array]
    },
    {
      path: '..\\..\\..\\Data\\Stoicisim\\Stoic quotes.mp4',
      name: 'Stoic quotes.mp4'
    },
    {
      path: '..\\..\\..\\Data\\Stoicisim\\Stoic.jpg',
      name: 'Stoic.jpg'
    }
  ]
}

Is this a new issue related to Windows 11?

regards

S.

mihneadb commented 2 years ago

Try JSON.stringify

On Sat, 12 Feb 2022 at 08:16, AngularNinja.com @.***> wrote:

running windows 11 node v14.17.5 script:

const PATH = require('path'); const dirTree = require('directory-tree');

const start = PATH.resolve(__dirname, '../../../Data/Upload/shared');

const tree = dirTree('./../../../Data/Stoicisim', {}, (item, PATH, stats) => { // console.log(item); });

console.log(tree)

and children are coming as [Array]

{ path: './../../../Data/Stoicisim', name: 'Stoicisim', children: [ { path: '..\..\..\Data\Stoicisim\quotes', name: 'quotes', children: [Array] }, { path: '..\..\..\Data\Stoicisim\simple', name: 'simple', children: [Array] }, { path: '..\..\..\Data\Stoicisim\Stoic quotes.mp4', name: 'Stoic quotes.mp4' }, { path: '..\..\..\Data\Stoicisim\Stoic.jpg', name: 'Stoic.jpg' } ] }

Is this a new issue related to Windows 11?

regards

S.

— Reply to this email directly, view it on GitHub https://github.com/mihneadb/node-directory-tree/issues/107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE5AN23KLO3SLHLL3HRUNLU2X3NXANCNFSM5OGINQ3A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- -- Mihnea Dobrescu-Balaur Sent from a mobile device.

born2net commented 2 years ago

thank you... did the trick. I guess that's what happens when you work without a debugger. ;) tx again.