@photostax/core 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/index.d.ts +0 -131
- package/package.json +7 -6
- package/photostax.linux-x64-gnu.node +0 -0
package/README.md
CHANGED
|
@@ -41,6 +41,10 @@ for (const stack of stacks) {
|
|
|
41
41
|
console.log(` Back: ${stack.back}`);
|
|
42
42
|
console.log(` EXIF Make: ${stack.metadata.exifTags['Make']}`);
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
// Paginate results (20 items starting at offset 0)
|
|
46
|
+
const page = repo.scanPaginated(0, 20);
|
|
47
|
+
console.log(`Showing ${page.items.length} of ${page.totalCount} total`);
|
|
44
48
|
```
|
|
45
49
|
|
|
46
50
|
## API Overview
|
|
@@ -56,6 +60,8 @@ The main class for accessing photo stacks.
|
|
|
56
60
|
| `readImage(path)` | Read raw image bytes as Buffer |
|
|
57
61
|
| `writeMetadata(id, metadata)` | Write metadata to a stack |
|
|
58
62
|
| `search(query)` | Find stacks matching a query |
|
|
63
|
+
| `scanPaginated(offset, limit)` | Scan with pagination (offset/limit) |
|
|
64
|
+
| `searchPaginated(query, offset, limit)` | Search with pagination (offset/limit) |
|
|
59
65
|
|
|
60
66
|
### PhotoStack
|
|
61
67
|
|
|
@@ -91,6 +97,18 @@ interface SearchQuery {
|
|
|
91
97
|
}
|
|
92
98
|
```
|
|
93
99
|
|
|
100
|
+
### PaginatedResult
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
interface PaginatedResult {
|
|
104
|
+
items: PhotoStack[]; // Items in this page
|
|
105
|
+
totalCount: number; // Total items across all pages
|
|
106
|
+
offset: number; // Offset used for this page
|
|
107
|
+
limit: number; // Limit used for this page
|
|
108
|
+
hasMore: boolean; // Whether more items exist beyond this page
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
94
112
|
### Utility Functions
|
|
95
113
|
|
|
96
114
|
| Function | Description |
|
package/index.d.ts
CHANGED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
/* auto-generated by NAPI-RS */
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Metadata associated with a photo stack.
|
|
8
|
-
*
|
|
9
|
-
* Combines EXIF tags (from image files), XMP tags (embedded or sidecar),
|
|
10
|
-
* and custom tags (from the sidecar database) into a unified view.
|
|
11
|
-
*/
|
|
12
|
-
export interface JsMetadata {
|
|
13
|
-
/** Standard EXIF tags from the image file (Make, Model, DateTime, etc.) */
|
|
14
|
-
exifTags: Record<string, string>
|
|
15
|
-
/** XMP/Dublin Core metadata tags */
|
|
16
|
-
xmpTags: Record<string, string>
|
|
17
|
-
/** Custom application metadata stored in the sidecar database */
|
|
18
|
-
customTags: Record<string, any>
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* A unified representation of a single scanned photo from an Epson FastFoto scanner.
|
|
22
|
-
*
|
|
23
|
-
* Groups the original scan, enhanced version, and back-of-photo image into
|
|
24
|
-
* a single logical unit with associated metadata.
|
|
25
|
-
*/
|
|
26
|
-
export interface JsPhotoStack {
|
|
27
|
-
/** Unique identifier derived from the base filename */
|
|
28
|
-
id: string
|
|
29
|
-
/** Path to the original front scan (may be null) */
|
|
30
|
-
original?: string
|
|
31
|
-
/** Path to the enhanced/color-corrected scan (may be null) */
|
|
32
|
-
enhanced?: string
|
|
33
|
-
/** Path to the back-of-photo scan (may be null) */
|
|
34
|
-
back?: string
|
|
35
|
-
/** Combined metadata from all sources */
|
|
36
|
-
metadata: JsMetadata
|
|
37
|
-
}
|
|
38
|
-
/** A key-value pair for search filters. */
|
|
39
|
-
export interface JsKeyValue {
|
|
40
|
-
/** The tag name to filter on */
|
|
41
|
-
key: string
|
|
42
|
-
/** The value substring to search for */
|
|
43
|
-
value: string
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Query parameters for searching photo stacks.
|
|
47
|
-
*
|
|
48
|
-
* All filters use AND logic - a stack must match all specified criteria.
|
|
49
|
-
*/
|
|
50
|
-
export interface JsSearchQuery {
|
|
51
|
-
/** Free-text search across ID and all metadata */
|
|
52
|
-
text?: string
|
|
53
|
-
/** EXIF tag filters (all must match) */
|
|
54
|
-
exifFilters?: Array<JsKeyValue>
|
|
55
|
-
/** Custom tag filters (all must match) */
|
|
56
|
-
customFilters?: Array<JsKeyValue>
|
|
57
|
-
/** Filter by presence of back scan */
|
|
58
|
-
hasBack?: boolean
|
|
59
|
-
/** Filter by presence of enhanced scan */
|
|
60
|
-
hasEnhanced?: boolean
|
|
61
|
-
}
|
|
62
|
-
/** Options for creating a PhotostaxRepository. */
|
|
63
|
-
export interface RepositoryOptions {
|
|
64
|
-
/**
|
|
65
|
-
* Whether to recurse into subdirectories (default: false).
|
|
66
|
-
*
|
|
67
|
-
* Set to `true` when the photo library uses FastFoto's folder-based
|
|
68
|
-
* organisation (e.g. `1984_Mexico/`, `SteveJones/`).
|
|
69
|
-
*/
|
|
70
|
-
recursive?: boolean
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* A repository for accessing Epson FastFoto photo stacks from a local directory.
|
|
74
|
-
*
|
|
75
|
-
* Provides methods to scan, retrieve, and modify photo stacks and their metadata.
|
|
76
|
-
*/
|
|
77
|
-
export declare class PhotostaxRepository {
|
|
78
|
-
/**
|
|
79
|
-
* Create a new repository rooted at the given directory path.
|
|
80
|
-
*
|
|
81
|
-
* @param directoryPath - Path to the directory containing FastFoto photo files
|
|
82
|
-
* @param options - Optional configuration (e.g. `{ recursive: true }`)
|
|
83
|
-
* @throws Error if the path is invalid
|
|
84
|
-
*/
|
|
85
|
-
constructor(directoryPath: string, options?: RepositoryOptions | undefined | null)
|
|
86
|
-
/**
|
|
87
|
-
* Scan the repository and return all discovered photo stacks.
|
|
88
|
-
*
|
|
89
|
-
* Groups files by FastFoto naming convention and enriches each stack
|
|
90
|
-
* with EXIF, XMP, and sidecar metadata.
|
|
91
|
-
*
|
|
92
|
-
* @returns Array of photo stacks found in the repository
|
|
93
|
-
* @throws Error if the directory cannot be accessed
|
|
94
|
-
*/
|
|
95
|
-
scan(): Array<JsPhotoStack>
|
|
96
|
-
/**
|
|
97
|
-
* Retrieve a single photo stack by its ID.
|
|
98
|
-
*
|
|
99
|
-
* @param id - The stack identifier (base filename without suffix)
|
|
100
|
-
* @returns The photo stack with the given ID
|
|
101
|
-
* @throws Error if the stack is not found or cannot be accessed
|
|
102
|
-
*/
|
|
103
|
-
getStack(id: string): JsPhotoStack
|
|
104
|
-
/**
|
|
105
|
-
* Read the raw bytes of an image file.
|
|
106
|
-
*
|
|
107
|
-
* @param path - Path to the image file (from a PhotoStack)
|
|
108
|
-
* @returns Buffer containing the image bytes
|
|
109
|
-
* @throws Error if the file cannot be read
|
|
110
|
-
*/
|
|
111
|
-
readImage(path: string): Buffer
|
|
112
|
-
/**
|
|
113
|
-
* Write metadata tags to a photo stack.
|
|
114
|
-
*
|
|
115
|
-
* XMP tags are written to the image file (or sidecar for TIFF).
|
|
116
|
-
* Custom and EXIF tags are stored in the sidecar database.
|
|
117
|
-
*
|
|
118
|
-
* @param stackId - The ID of the stack to update
|
|
119
|
-
* @param metadata - The metadata to write
|
|
120
|
-
* @throws Error if the stack is not found or metadata cannot be written
|
|
121
|
-
*/
|
|
122
|
-
writeMetadata(stackId: string, metadata: JsMetadata): void
|
|
123
|
-
/**
|
|
124
|
-
* Search for photo stacks matching the given query.
|
|
125
|
-
*
|
|
126
|
-
* @param query - Search criteria (all filters are AND'd together)
|
|
127
|
-
* @returns Array of matching photo stacks
|
|
128
|
-
* @throws Error if the repository cannot be scanned
|
|
129
|
-
*/
|
|
130
|
-
search(query: JsSearchQuery): Array<JsPhotoStack>
|
|
131
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@photostax/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Unified photo stack library for Epson FastFoto repositories - Node.js binding",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"prepublishOnly": "napi prepublish -t npm"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@napi-rs/cli": "^
|
|
25
|
+
"@napi-rs/cli": "^3.0.0",
|
|
26
26
|
"@types/jest": "^29.0.0",
|
|
27
|
-
"@types/node": "^
|
|
27
|
+
"@types/node": "^25.0.0",
|
|
28
28
|
"jest": "^29.0.0",
|
|
29
29
|
"ts-jest": "^29.0.0",
|
|
30
30
|
"typescript": "^5.0.0"
|
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
"jpeg"
|
|
46
46
|
],
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@photostax/core-
|
|
49
|
-
"@photostax/core-darwin-
|
|
50
|
-
"@photostax/core-
|
|
48
|
+
"@photostax/core-darwin-x64": "0.1.4",
|
|
49
|
+
"@photostax/core-darwin-arm64": "0.1.4",
|
|
50
|
+
"@photostax/core-win32-x64-msvc": "0.1.4",
|
|
51
|
+
"@photostax/core-linux-x64-gnu": "0.1.4"
|
|
51
52
|
}
|
|
52
53
|
}
|
|
Binary file
|