# Help with Filesystem

**URL:** <https://discourse.nodered.org/t/help-with-filesystem/65393>\
**Category:** General\
**Created:** [20 July 2022 20:07 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393 "2022-07-20T20:07:18Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [28 July 2022 03:03 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/22 "2022-07-28T03:03:20Z")

</div>

nope just in the other nodes you were trying

Craig

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [28 July 2022 03:09 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/23 "2022-07-28T03:09:22Z")

</div>

What about this ??

> **[GitHub - eflexsystems/node-samba-client: Node.js wrapper for smbclient](https://github.com/eflexsystems/node-samba-client)**
>
> Node.js wrapper for smbclient. Contribute to eflexsystems/node-samba-client development by creating an account on GitHub.

> [@How to use an npm module within a function node?](https://discourse.nodered.org/t/how-to-use-an-npm-module-within-a-function-node/20917/3):
>
> Also the documentation is worth checking before asking: [https://nodered.org/docs/user-guide/writing-functions#loading-additional-modules](https://nodered.org/docs/user-guide/writing-functions#loading-additional-modules)

Craig

---

<div class="post-metadata">

**Author:** ![jgreenmt](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jgreenmt](https://discourse.nodered.org/u/jgreenmt)\
**Post date:** [28 July 2022 16:46 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/24 "2022-07-28T16:46:22Z")

</div>

This looks very promising. So to make sure I have the general idea right.

1. Use npm in command line to install the Node.js wrapper for smbclient

2. In Node-RED download `node-red-contrib-npm`

From there I configure the `npm` node to call the functions from the wrapper? These are the settings I'm thinking are correct:

NPM Module: node-samba-client

Module Style: Not sure if Module Function or Custom

If Module Function, for the function parameter would I use  
`await client.getFile('someRemotePath/file', 'destinationFolder/name');`

Am I on the right track?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 July 2022 18:15 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/25 "2022-07-28T18:15:06Z")

</div>

> [@jgreenmt](#):
>
> - Use npm in command line to install the Node.js wrapper for smbclient
> - In Node-RED download `node-red-contrib-npm`

Not necessary.

Just use the `setup` tab to import nodes  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/e/7ee47e8dea501fd72f59062137b1b2399032b51e.png)

node-red will download the package.

Then in the function node, write code.

---

<div class="post-metadata">

**Author:** ![jgreenmt](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jgreenmt](https://discourse.nodered.org/u/jgreenmt)\
**Post date:** [28 July 2022 18:22 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/26 "2022-07-28T18:22:14Z")

</div>

This is much simpler. I vaguely remember reading where I needed to adjust my settings.js file for this to work. Is that still the case?

So looking at the API on the Github page, when I run a command such as  
`await client.getFile('someRemotePath/file', 'destinationFolder/name');`  
It will map the remote file to the destination folder? Is this basically dynamic mounting like @craigcurtin mentioned?

---

<div class="post-metadata">

**Author:** ![jgreenmt](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jgreenmt](https://discourse.nodered.org/u/jgreenmt)\
**Post date:** [28 July 2022 18:30 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/27 "2022-07-28T18:30:08Z")

</div>

I edited this post as I was able to use it correctly. I had to remove the first line as the "require" is not needed. Then I had to adjust "SambaClient" to "sambaClient to match the setup. It moved my file correctly.

I would still prefer if I could read the contents of the file without having to transfer/mount it. Is this possible?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 July 2022 18:40 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/28 "2022-07-28T18:40:12Z")

</div>

Don't use require. That's what the setup tab does.

---

<div class="post-metadata">

**Author:** ![jgreenmt](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jgreenmt](https://discourse.nodered.org/u/jgreenmt)\
**Post date:** [28 July 2022 18:48 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/29 "2022-07-28T18:48:46Z")

</div>

I wasn't expecting such a quick response so my edit doesn't make much sense now but I think the point still gets across. The function works properly and is pretty neat. But I am still wondering if there is a way to read the contents of the file without mounting/transferring the file. Should I give up on that?

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [28 July 2022 21:49 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/30 "2022-07-28T21:49:30Z")

</div>

Yes there is no concept of a "dynamic" link so it does have to be mounted/unmounted

When you finish would you post up your flow so others can see and benefit also

Craig

---

<div class="post-metadata">

**Author:** ![jgreenmt](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jgreenmt](https://discourse.nodered.org/u/jgreenmt)\
**Post date:** [28 July 2022 22:41 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/31 "2022-07-28T22:41:23Z")

</div>

Just to clarify there's no way on the Pi to replicate what I'm able to do from Windows-Windows where I can essentially open/read the file without mounting?

Last question is am I in the same boat when it comes to reading Pi-Pi files on a network? No way to open/read files without mounting?

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [28 July 2022 22:58 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/32 "2022-07-28T22:58:02Z")

</div>

Windows just lets you think you are accessing the files with magic - what it actually does is store the credentials for access in the Credential store and then use those on an ongoing basis.

There is not the same concept in Linux - unless you do a public share that is read/write on Samba and then you basically get the same thing

Craig

---

<div class="post-metadata">

**Author:** ![jgreenmt](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jgreenmt](https://discourse.nodered.org/u/jgreenmt)\
**Post date:** [29 July 2022 01:02 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/33 "2022-07-29T01:02:34Z")

</div>

So if I create a public Samba share on a Pi how would I then access it in a similar manner to Windows?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 September 2022 01:03 UTC](https://discourse.nodered.org/t/help-with-filesystem/65393/34 "2022-09-27T01:03:33Z")

</div>

Closed on 27 September 2022 01:03 UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/help-with-filesystem/65393.md?page=1)
