Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lowks/Radpath
Path library for Elixir inspired by Python's pathlib
https://github.com/lowks/Radpath
Last synced: 8 days ago
JSON representation
Path library for Elixir inspired by Python's pathlib
- Host: GitHub
- URL: https://github.com/lowks/Radpath
- Owner: lowks
- License: mit
- Created: 2014-03-12T22:51:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-02-24T03:58:45.000Z (over 3 years ago)
- Last Synced: 2024-10-18T05:07:44.173Z (22 days ago)
- Language: Elixir
- Homepage:
- Size: 1.73 MB
- Stars: 22
- Watchers: 5
- Forks: 8
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Path library for Elixir, inspired by Python's Enhpath. (Files and Directories)
- fucking-awesome-elixir - Radpath - Path library for Elixir, inspired by Python's Enhpath. (Files and Directories)
- awesome-elixir - Radpath - Path library for Elixir, inspired by Python's Enhpath. (Files and Directories)
README
# Radpath
[![Build Status](https://travis-ci.org/lowks/Radpath.png?branch=master)](https://travis-ci.org/lowks/Radpath)
[![Build Status](https://drone.io/github.com/lowks/Radpath/status.png)](https://drone.io/github.com/lowks/Radpath/latest)
[![wercker status](https://app.wercker.com/status/10f2bf7288af1be5c4e39f25367bb3b7/s/master "wercker status")](https://app.wercker.com/project/byKey/10f2bf7288af1be5c4e39f25367bb3b7)
[![Circle CI](https://circleci.com/gh/lowks/Radpath/tree/master.png?style=badge)](https://circleci.com/gh/lowks/Radpath/tree/master)
[![Inline docs](http://inch-ci.org/github/lowks/Radpath.svg?branch=master&style=flat)](http://inch-ci.org/github/lowks/Radpath)
[![Build Status](https://snap-ci.com/lowks/Radpath/branch/master/build_image)](https://snap-ci.com/lowks/Radpath/branch/master/build_image)
[![Coverage Status](https://coveralls.io/repos/lowks/Radpath/badge.png?branch=master)](https://coveralls.io/r/lowks/Radpath?branch=master)A library for dealing with paths in Elixir largely inspired by Python's pathlib.
## Getting Started
To use Radpath, add a dependency in your mix:
```elixir
def deps do
[ { :Radpath, github: "lowks/Radpath"}]
end
```then `mix deps.get` fetches dependencies and compiles Radpath.
## Status
Developed whenever I can find the time.
## Running Tests
Running tests against a stable release of Elixir defined by 'STABLE_ELIXIR_VERSION' in the Makefile:
```bash
make ci
```Running tests against your system's Elixir:
```bash
make
```## Docs (Lite Version)
To list down files in a path:
```elixir
Radpath.files("/home/lowks/Documents")
```or if you wanted to filter out certain files with pdf extensions:
```elixir
Radpath.files("/home/lowks/Documents", "pdf")
```Listing down only directories:
```elixir
Radpath.dirs("/home/lowks")
```To create symlink:
```elixir
Radpath.symlink(source, destination)
```To create tempfile:
```elixir
{status, fd, file_path} = Radpath.mktempfile
IO.write fd, "hoho"
File.close fd
File.read! filepath
"hoho"
File.rm! filepath
```This uses all the defaults
To customize the location plus the extension:
```elixir
{_, fd, filepath} = Radpath.mktempfile(".log", "/home/lowks/Downloads")
IO.write fd, "hoho"
File.read! filepath
"hoho"
File.close! filepath
```The default is ".log". Checkout the rest of the docs in the docs folder.
Run `mix docs` to generate a nice docs in a local folder or you can read them online: [Radpath hexdocs](http://hexdocs.pm/radpath/ "Hexdocs link for Radpath")
Check out [test examples](./test/radpath_test.exs) for usage.