Git Product home page Git Product logo

downloads-folder's Introduction

downloads-folder

Get the local downloads folder, for all major platforms.

Usage

const downloadsFolder = require('downloads-folder');

console.log(downloadsFolder());

Installation

$ npm install downloads-folder

API

downloadsFolder()

Return the location of the downloads folder for the current platform.

Warning: On *nix, this will perform synchronous operations, so don't place it where concurrency is required. It's probably the best to just determine this folder once when your application starts.

Algorithm

  • Mac OS X: ~/Downloads
  • Windows: Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders{374DE290-123F-4565-9164-39C4925E467B} || ~/Downloads
  • *nix: xdg-user-dir DOWNLOAD || ~/Downloads || /tmp

License

MIT

downloads-folder's People

Contributors

baonhan avatar dependabot[bot] avatar greenkeeper[bot] avatar juliangruber avatar remithomas avatar tobimori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

downloads-folder's Issues

Doesn't track windows download's folder move

image

On windows it's possible to move your downloads folder to a drive that your user folder isn't on, and in this situation this package will point to the incorrect downloads location. Unsure if there's an easy way to find this new location with node however.

Error handling when xdg-user-dir is not found

I was using this package as part of an integration test in a containerized environment, and I found out that my container does not have xdg-user-dir. Because of that, the following line causes my pipeline to exit prematurely:

dir = execSync('xdg-user-dir DOWNLOAD', { stdio: [0, 3, 3] });

Just wanted to check what does the [0, 3, 3] mean? Because I can't find it in the Node.js docs: https://nodejs.org/api/child_process.html#child_process_options_stdio

webpack error

What is exact webpack specification for your package?
I have these errors:

ERROR in ./node_modules/downloads-folder/index.js
Module not found: Error: Can't resolve 'child_process' in 'E:\Develop\Photoshop\UXP\c4-uxp-photoshop-plugin-spectrum-with-pure-javascript\node_modules\downloads-folder'
@ ./node_modules/downloads-folder/index.js 4:17-41
@ ./src/c4.js
@ ./src/actions.js
@ ./src/index.js

ERROR in ./node_modules/downloads-folder/index.js
Module not found: Error: Can't resolve 'fs' in 'E:\Develop\Photoshop\UXP\c4-uxp-photoshop-plugin-spectrum-with-pure-javascript\node_modules\downloads-folder'
@ ./node_modules/downloads-folder/index.js 5:17-30
@ ./src/c4.js
@ ./src/actions.js
@ ./src/index.js

ERROR in ./node_modules/registry-js/build/Release/registry.node 1:2
Module parse failed: Unexpected character '�' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
@ ./node_modules/registry-js/dist/lib/registry.js 5:6-50
@ ./node_modules/registry-js/dist/lib/index.js
@ ./node_modules/downloads-folder/index.js
@ ./src/c4.js
@ ./src/actions.js
@ ./src/index.js

Thx
Karoly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.