The trivial-file-size Reference Manual

Table of Contents

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 2.3 "Robert April" on Tue Feb 20 09:26:50 2018 GMT+0.


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

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.


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

2 Systems

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


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

2.1 trivial-file-size

Author

Paul M. Rodriguez <pmr@ruricolist.com>

License

MIT

Description

Stat a file’s size.

Dependencies
Source

trivial-file-size.asd (file)

Components

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

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 files   [Contents][Index]

3.1.1 trivial-file-size.asd

Location

trivial-file-size.asd

Systems

trivial-file-size (system)


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

3.1.2 trivial-file-size/package.lisp

Parent

trivial-file-size (system)

Location

package.lisp

Packages

trivial-file-size


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

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

Dependency

package.lisp (file)

Parent

trivial-file-size (system)

Location

trivial-file-size.lisp

Exported Definitions

file-size-in-octets (function)

Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 trivial-file-size

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions

file-size-in-octets (function)

Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 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 (file)


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

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: file-size-from-stream FILE
Package

trivial-file-size

Source

trivial-file-size.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Types

Type: file-size ()
Package

trivial-file-size

Source

trivial-file-size.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-file-size.asd: The trivial-file-size<dot>asd file
File, Lisp, trivial-file-size/package.lisp: The trivial-file-size/package<dot>lisp file
File, Lisp, trivial-file-size/trivial-file-size.lisp: The trivial-file-size/trivial-file-size<dot>lisp file

L
Lisp File, trivial-file-size.asd: The trivial-file-size<dot>asd file
Lisp File, trivial-file-size/package.lisp: The trivial-file-size/package<dot>lisp file
Lisp File, trivial-file-size/trivial-file-size.lisp: The trivial-file-size/trivial-file-size<dot>lisp file

T
trivial-file-size.asd: The trivial-file-size<dot>asd file
trivial-file-size/package.lisp: The trivial-file-size/package<dot>lisp file
trivial-file-size/trivial-file-size.lisp: The trivial-file-size/trivial-file-size<dot>lisp file

Jump to:   F   L   T  

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

A.2 Functions

Jump to:   F  
Index Entry  Section

F
file-size-from-stream: Internal functions
file-size-in-octets: Exported functions
Function, file-size-from-stream: Internal functions
Function, file-size-in-octets: Exported functions

Jump to:   F  

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

A.3 Variables


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

A.4 Data types

Jump to:   F   P   S   T  
Index Entry  Section

F
file-size: Internal types

P
Package, trivial-file-size: The trivial-file-size package

S
System, trivial-file-size: The trivial-file-size system

T
trivial-file-size: The trivial-file-size system
trivial-file-size: The trivial-file-size package
Type, file-size: Internal types

Jump to:   F   P   S   T