https://github.com/takumakume/mruby-file-access
accsess(2) for mruby. This is a fast file check method.
https://github.com/takumakume/mruby-file-access
access mruby
Last synced: about 1 year ago
JSON representation
accsess(2) for mruby. This is a fast file check method.
- Host: GitHub
- URL: https://github.com/takumakume/mruby-file-access
- Owner: takumakume
- License: other
- Created: 2017-06-26T00:32:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-13T04:12:00.000Z (about 8 years ago)
- Last Synced: 2025-01-26T18:34:21.005Z (about 1 year ago)
- Topics: access, mruby
- Language: C
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mruby-file-access [](https://travis-ci.org/takumakume/mruby-file-access)
accsess(2) for mruby.
This is a fast file check method.
## install by mrbgems
- add conf.gem line to `build_config.rb`
```ruby
MRuby::Build.new do |conf|
# ... (snip) ...
conf.gem :github => 'takumakume/mruby-file-access'
end
```
## methods
```ruby
File::Access.exist?(pathname) # or File::Access.exists?(pathname)
File::Access.readable?(pathname)
File::Access.writable?(pathname)
File::Access.executable?(pathname)
```
## benchmark
- using stat(2)
```ruby
1000000.times do
File.exist?("samplefile")
end
```
```shell
# time mruby stat.rb
mruby stat.rb 1.53s user 0.31s system 99% cpu 1.857 total
```
- using access(2)
```ruby
1000000.times do
File::Access.exist?("samplefile")
end
```
```sh
# time mruby access.rb
mruby access.rb 0.61s user 0.40s system 98% cpu 1.026 total
```
## License
under the MIT License:
- see LICENSE file