Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read a file in node.js?

Rohit Mishra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 11, 2019

Hi guys,

I am new to Bitbucket and trying to read a file from a remote repo using Node.js. I was able to read it from the local repo using the 'fs' module, but can't seem to be able to read it from the remote one. 

Could anyone help me with this? Appreciate any help! 

1 answer

1 vote
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 12, 2019
Hi Rohit, welcome to the Community!
This question is not really related to Bitbucket (apart from the file being hosted in Bitbucket) it's more of a programming question, but I'll try to help you anyway :)
My understanding is that you want to write a script that will read a file from Bitbucket. You can do that by using "fs" but you'll need to clone the repo first. 
You could execute a command like "git clone --shallow... " from nodejs using https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback,  or you could also use a Git client for nodejs.
In the future, if you have any questions like this, remember you can find more resources in our Developer Community.
Hope that helps!
Ana
Rohit Mishra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 13, 2019

Hey Ana, thanks for answering. I'll put this up on the dev community. Thanks again! :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events