You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app.Logger().Fatalf("Failed to initialize Azure File Storage: %v", err)
193
+
}
194
+
195
+
app.AddFileStore(fs)
196
+
197
+
app.Run()
198
+
}
199
+
```
200
+
201
+
> **Note:**
202
+
> - Azure File Storage uses file shares (similar to S3 buckets or GCS buckets)
203
+
> - Authentication requires both `AccountName` and `AccountKey`
204
+
> - The `Endpoint` field is optional and defaults to `https://{AccountName}.file.core.windows.net`
205
+
> - Currently supports one file share per file-store instance
206
+
> - The implementation automatically retries connection if the initial connection fails
207
+
> -**Automatic parent directory creation**: When creating files in nested paths (e.g., `dir1/subdir/file.txt`), parent directories are automatically created, matching local filesystem behavior
208
+
> -**Content type detection**: Content types are automatically detected based on file extensions (e.g., `.json` → `application/json`, `.txt` → `text/plain`)
> - Files can be created in nested directories (e.g., `dir1/subdir/file.txt`). Parent directories are automatically created if they don't exist
291
+
> - Content types are automatically detected based on file extensions (e.g., `.json`, `.txt`, `.csv`, `.xml`, `.html`, `.pdf`)
292
+
> - This behavior matches local filesystem operations for consistency
293
+
243
294
### Reading file as CSV/JSON/TEXT
244
295
245
296
GoFr support reading CSV/JSON/TEXT files line by line.
@@ -304,6 +355,8 @@ fmt.Printf("%v: %v Size: %v Last Modified Time : %v\n", entryType, entry.Name(),
304
355
> - Names starting with "0" are interpreted as binary files, with the "0" prefix removed (S3 specific behavior).
305
356
>
306
357
> For directories, the method calculates the total size of all contained objects and returns the most recent modification time. For files, it directly returns the file's size and last modified time.
358
+
>
359
+
> Azure File Storage supports native file and directory structures, so `Stat` returns accurate metadata for both files and directories.
> Note: Currently, the S3 package supports the deletion of unversioned files from general-purpose buckets only. Directory buckets and versioned files are not supported for deletion by this method. GCS supports deletion of both files and empty directories.
375
+
> Note: Currently, the S3 package supports the deletion of unversioned files from general-purpose buckets only. Directory buckets and versioned files are not supported for deletion by this method. GCS supports deletion of both files and empty directories. Azure File Storage supports deletion of both files and empty directories.
The `RemoveAll` command deletes all subdirectories as well. If you delete the current working directory, such as "../currentDir", the working directory will be reset to its parent directory.
329
382
330
383
> Note: In S3, RemoveAll only supports deleting directories and will return an error if a file path (as indicated by a file extension) is provided for S3.
331
-
> GCS handles both files and directories.
384
+
> GCS and Azure File Storage handle both files and directories.
332
385
333
386
```go
334
387
err:= ctx.File.RemoveAll("my_dir/my_text")
335
388
```
336
389
337
390
> GoFr supports relative paths, allowing locations to be referenced relative to the current working directory. However, since S3 and GCS use
338
-
> a flat file structure, all methods require a full path relative to the bucket.
391
+
> a flat file structure, all methods require a full path relative to the bucket. Azure File Storage supports native directory structures,
392
+
> so relative paths work as expected with directory navigation.
339
393
340
394
> Errors have been skipped in the example to focus on the core logic, it is recommended to handle all the errors.
0 commit comments