class GPhoto2::CameraFile

Included Modules

Defined in:

gphoto2/camera_file.cr

Constant Summary

BUFFER_SIZE = 256 * 1024

Initial buffer size used in #read.

PREVIEW_FILENAME = "capture_preview.jpg"

The preview data is assumed to be a jpg.

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module GPhoto2::Struct(LibGPhoto2::CameraFile)

ptr : Pointer(T) ptr, ptr? : Pointer(T) | Nil ptr?, to_unsafe : Pointer(T) to_unsafe, wrapped : T wrapped

Constructor methods inherited from module GPhoto2::Struct(LibGPhoto2::CameraFile)

new(ptr : Pointer(T) | Nil = nil) new

Constructor Detail

def self.new(camera : GPhoto2::Camera, folder : Nil | String = nil, name : Nil | String = nil) #

NOTE allocates memory.


[View source]

Class Method Detail

def self.join(*args : String) : String #

Returns a new string formed by joining the strings using /.

NOTE OS-independent substitute of File.join applicable to libgphoto2 fs.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


[View source]
def close : Nil #

NOTE frees allocated memory.


[View source]
def data : Pointer(UInt8) #

Returns pointer file data.


[View source]
def delete : Nil #

Deletes file from the camera.


[View source]
def extension : String #

Returns file extension in lowercase (without leading dot).


[View source]
def finalize #

Finalizes object by freeing allocated memory.


[View source]
def folder : String #

Directory part of the file path.


[View source]
def folder? : String | Nil #

Directory part of the file path.


[View source]
def info : CameraFileInfo #

Returns an object containing information about the file.


[View source]
def name : String #

Filename part of the file path.


[View source]
def name? : String | Nil #

Filename part of the file path.


[View source]
def path : String #

Returns full file path (within the camera filesystem).


[View source]
def preview? #

Returns true if file is a preview.


[View source]
def read : Bytes #

Reads file directly from the camera.


[View source]
def save(path : String | Path = default_filename) : Nil #

Saves file #data at given pathname.


[View source]
def size : UInt64 #

Returns file size (in bytes).


[View source]
def to_s #

Returns file #path.


[View source]
def to_slice : Bytes #

Returns file #data as Bytes.


[View source]