The trivial-file-size Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-file-size Reference Manual

This is the trivial-file-size Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 06:03:11 2022 GMT+0.

Table of Contents


1 Introduction

trivial-file-size

This library exports a single function, file-size-in-octets. It returns the size of a file in bytes, using system calls when possible.

The canonical way to determine the size of a file in bytes, using Common Lisp, is to open the file with an element type of (unsigned-byte 8) and then calculate the length of the stream. This is less than ideal. In most cases it would be better to get the size of the file from its metadata, using a system call.

This is a problem I have run into several times in several different projects. I want it solved, once and for all.

At the moment, getting the file size from metadata is supported for the following Lisps:

For other Lisps and platforms, we fall back to opening the file and calling file-length on the stream.

This library is as much a call to arms as it is a resource. If you know how to stat a file on your Common Lisp implementation, on your platform, please make a pull request -- or just open an issue to point me to the right documentation, and I'll do all the work.


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-file-size

Stat a file’s size.

Author

Paul M. Rodriguez <pmr@ruricolist.com>

License

MIT

Dependencies
  • sb-posix (system)., required, for feature :sbcl
  • uiop (system).
Source

trivial-file-size.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 trivial-file-size/trivial-file-size.asd

Source

trivial-file-size.asd.

Parent Component

trivial-file-size (system).

ASDF Systems

trivial-file-size.


3.1.2 trivial-file-size/package.lisp

Source

trivial-file-size.asd.

Parent Component

trivial-file-size (system).

Packages

trivial-file-size.


3.1.3 trivial-file-size/trivial-file-size.lisp

Dependency

package.lisp (file).

Source

trivial-file-size.asd.

Parent Component

trivial-file-size (system).

Public Interface

file-size-in-octets (function).

Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 trivial-file-size

Source

package.lisp.

Use List

common-lisp.

Public Interface

file-size-in-octets (function).

Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: file-size-in-octets (file)

Return the size of FILE in octets.
Whenever possible, get the size from the file’s metadata.

Some platforms (e.g. ABCL) may return 0 when the file does not exist.

Package

trivial-file-size.

Source

trivial-file-size.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Ordinary functions

Function: file-size-from-stream (file)
Package

trivial-file-size.

Source

trivial-file-size.lisp.


5.2.2 Types

Type: file-size ()
Package

trivial-file-size.

Source

trivial-file-size.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables