Paths
Paths
classWrapper around the native path modules with some getters to access common locations.
Delegates to path#join
.
Returns String
Delegates to path#resolve
.
Parameters
location
Returns String
Path to the project’s root.
Returns String
Path to the user’s folder.
Returns String
Inferred path containing the user’s musics.
Returns String
Path to the user’s data folder (e.g. “/home/john/.daplayer”).
Returns String
Path to the default artwork image.
Returns String
Path to the folder containing cover images.
Returns String
Path to the folder containing artist images.
Returns String
Path to the folder containing playlists.
Returns String
Path to the “YouTube History” playlist file
Returns String
List of paths to ensure are created when the application boots up as we may try to access to them.
Returns Array
Check whether a given path exists or not.
Paths.exists('user')
will return true only if
Paths.user
exists on the file system.
Paths.exists('/home/jacky/foo.mp3')
will return true
if the file exists on system.
Parameters
location
String The getter to call or a
full path.Returns Boolean
Creates a new directory getting the wanted path delegating to the given getter’s name.
Paths.mkdir('user')
will create the Paths.user
folder.
We are relying on the synchronous counter-part of
mkdir
since we want to block the event loop
creating folders.
Parameters
name
String The getter to call.Returns null
Touches the JSPF file for the YouTube history.
We are not relying on the LocalModel#savePlaylist
method
as this would do extra computation to guess the file name
and we want to save this file synchronously to avoid race
conditions plus we don’t have to require anything else
apart from this file in the main.js
one.
Returns null
Returns the exact file’s path to store a file that’s going to be downloaded based on the title, the artist and the service.
Parameters
title
String The media’s title.artist
String The media’s artist.service
String The download service.extension
[String] The file’s extension.Returns String