Write data to a given ``filepath`` with 'w' mode. Note: ``write_text`` will create a directory if the directory of ``filepath`` does not exist. Args: obj (str): Data to be written. filepath (str or Path): Path to write data.
(obj: str, uri: str, encoding: str = "utf-8")
| 382 | |
| 383 | @staticmethod |
| 384 | def write_text(obj: str, uri: str, encoding: str = "utf-8") -> None: |
| 385 | """Write data to a given ``filepath`` with 'w' mode. |
| 386 | |
| 387 | Note: |
| 388 | ``write_text`` will create a directory if the directory of |
| 389 | ``filepath`` does not exist. |
| 390 | |
| 391 | Args: |
| 392 | obj (str): Data to be written. |
| 393 | filepath (str or Path): Path to write data. |
| 394 | encoding (str): The encoding format used to open the ``filepath``. |
| 395 | Default: 'utf-8'. |
| 396 | """ |
| 397 | storage = File._get_storage(uri) |
| 398 | return storage.write_text(obj, uri) |
| 399 | |
| 400 | @contextlib.contextmanager |
| 401 | def as_local_path(uri: str) -> Generator[Union[str, Path], None, None]: |